/Users/thachakritkomolkhetruck/Desktop/IA_NetBeans_Project copy/src/Prototype/Prototype.java |
1 /*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6 package Prototype;
7
8 /**
9 *
10 * @author 19706
11 */
12 import javax.swing.*;
13 import java.awt.event.*;
14 import javax.swing.JFrame;
15 import java.util.stream.Collectors;
16 import javax.swing.JTextField;
17
18 import java.io.FileWriter;
19 import java.io.IOException;
20 import java.io.FileReader;
21 import java.io.File; // Import the File class
22 import java.io.FileNotFoundException; // Import this class to handle errors
23 import java.util.Scanner; // Import the Scanner class to read text files
24 import java.io.BufferedReader;
25 import java.util.*;
26 import java.nio.file.Files;
27 import java.nio.file.Paths;
28
29 import java.io.ByteArrayInputStream;
30 import java.io.ByteArrayOutputStream;
31 import java.io.FilenameFilter;
32 import java.io.IOException;
33 import java.io.ObjectOutputStream;
34 import java.io.ObjectInputStream;
35 import java.util.StringTokenizer;
36 import java.util.logging.Level;
37 import java.util.logging.Logger;
38 import javax.swing.ButtonGroup;
39 import javax.swing.JOptionPane;
40 import javax.swing.table.DefaultTableModel;
41
42 import org.apache.commons.codec.DecoderException;
43 import org.apache.commons.codec.binary.Base64;
44 import org.apache.commons.codec.binary.Hex;
45 import org.json.simple.JSONArray;
46 import org.json.simple.JSONObject;
47 import org.json.simple.parser.JSONParser;
48 import org.json.simple.parser.ParseException;
49
50 public class Prototype extends javax.swing.JFrame {
51 private PokemonSet fieldOpponent;
52 private PokemonSet fieldOwn;
53 private PokemonSet[] ownTeam = new PokemonSet[6];
54 private PokemonSet[] opponentTeam = new PokemonSet[6];
55 private String[] arrayTeam = new String [6];
56 private boolean start_ = false;
57 private String pokemon1 ;
58 private String pokemon2 ;
59 private String pokemon3 ;
60 private String pokemon4 ;
61 private String pokemon5 ;
62 private String pokemon6 ;
63 private String yourpokemonStage ;
64 private String opponentpokemonStage ;
65 private String opponentState ;
66 private String opponentpokemonList ;
67 private int health1 = 100;
68 private int health2 = 100;
69 private int health3 = 100;
70 private int health4 = 100;
71 private int health5 = 59;
72 private int health6 = 100;
73 private int health7 = 100;
74 private int health8 = 100;
75 private int health9 = 100;
76 private int health10 = 100;
77 private int health11 = 100;
78 private int health12 = 100;
79 private String noteAdvice ;
80 private String notePredict ;
81 /**
82 * Creates new form Prototype
83 */
84
85 public Prototype() {
86 initComponents();
87
88 }
89
90 /**
91 * This method is called from within the constructor to initialize the form.
92 * WARNING: Do NOT modify this code. The content of this method is always
93 * regenerated by the Form Editor.
94 */
95 @SuppressWarnings("unchecked")
96 // private void myInit(){
97 // ownTeam = processOwnTeam(inputTF.getText());
98 //
99 // }
100 // private PokemonSet[] processOwnTeam(String import){
101 //
102 // }
103 // private PokemonSet[] processOopponentTeam(String import){
104 //
105 // }
106 private void setAllPokemon(){
107
108 }
109 private void setAllMoves(){
110
111 }
112
971 }// </editor-fold>
972
973 private void searchTeamButtonMouseReleased(java.awt.event.MouseEvent evt) {
974 // TODO add your handling code here:
975 allPokemonTable.setModel(new DefaultTableModel(null, new String[]{"Pokemon", "Move 1", "Move 2", "Move 3", "Move 4", "Item", "Ability"}));
976 teamTable.setModel(new DefaultTableModel(null, new String[]{"Team"}));
977 String pokemon1 = null;
978 String pokemon2 = null;
979 String pokemon3 = null;
980 String pokemon4 = null;
981 String pokemon5 = null;
982 String pokemon6 = null;
983 try {
984 File myObj = new File("./src/Team/"+ teamNameTF.getText()+".txt");
985 Scanner myReader = new Scanner(myObj);
986 while (myReader.hasNextLine()) {
987 String data = myReader.nextLine();
988 String teamName[] = {teamNameTF.getText()};
989 DefaultTableModel tb1Model = (DefaultTableModel)teamTable.getModel();
990 tb1Model.addRow(teamName);
991
992 // split string to 6 set
993 String[] arrOfStr = data.split(", ", 6);
994 pokemon1 = arrOfStr[0].substring(1);
995 pokemon2 = arrOfStr[1];
996 pokemon3 = arrOfStr[2];
997 pokemon4 = arrOfStr[3];
998 pokemon5 = arrOfStr[4];
999 pokemon6 = arrOfStr[5].substring(0, arrOfStr[5].length() - 1 );
1000 // split string to 6 set
1001 }
1002 myReader.close();
1003 errorTF.setText("");
1004
1005 // find pokemon 1
1006 String pokemon1Line1 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon1+".txt")).get(0);
1007 String pokemon1Line2 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon1+".txt")).get(1);
1008 String[] arrOfStr = pokemon1Line2.split(", ", 4);
1009 String pokemon1Line3 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon1+".txt")).get(2);
1010 String pokemon1Line4 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon1+".txt")).get(3);
1011
1012 String detailPokemon1[] = {pokemon1Line1, arrOfStr[0].substring(1), arrOfStr[1], arrOfStr[2], arrOfStr[3].substring(0, arrOfStr[3].length() - 1), pokemon1Line3, pokemon1Line4};
1013 DefaultTableModel tb1Model = (DefaultTableModel)allPokemonTable.getModel();
1014 tb1Model.addRow(detailPokemon1);
1015 // find pokemon 1
1016
1017 // find pokemon 2
1018 String pokemon2Line1 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon2+".txt")).get(0);
1019 String pokemon2Line2 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon2+".txt")).get(1);
1020 String[] arrOfStr2 = pokemon2Line2.split(", ", 4);
1021 String pokemon2Line3 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon2+".txt")).get(2);
1022 String pokemon2Line4 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon2+".txt")).get(3);
1023 String detailPokemon2[] = {pokemon2Line1, arrOfStr2[0].substring(1), arrOfStr2[1], arrOfStr2[2], arrOfStr2[3].substring(0, arrOfStr2[3].length() - 1), pokemon2Line3, pokemon2Line4};
1024 DefaultTableModel tb1Mode2 = (DefaultTableModel)allPokemonTable.getModel();
1025 tb1Mode2.addRow(detailPokemon2);
1026 // find pokemon 2
1027
1028 // find pokemon 3
1029 String pokemon3Line1 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon3+".txt")).get(0);
1030 String pokemon3Line2 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon3+".txt")).get(1);
1031 String[] arrOfStr3 = pokemon3Line2.split(", ", 4);
1032 String pokemon3Line3 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon3+".txt")).get(2);
1033 String pokemon3Line4 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon3+".txt")).get(3);
1034 String detailPokemon3[] = {pokemon3Line1, arrOfStr3[0].substring(1), arrOfStr3[1], arrOfStr3[2], arrOfStr3[3].substring(0, arrOfStr3[3].length() - 1), pokemon3Line3, pokemon3Line4};
1035 DefaultTableModel tb1Mode3 = (DefaultTableModel)allPokemonTable.getModel();
1036 tb1Mode3.addRow(detailPokemon3);
1037 // find pokemon 3
1038
1039 // find pokemon 4
1040 String pokemon4Line1 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon4+".txt")).get(0);
1041 String pokemon4Line2 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon4+".txt")).get(1);
1042 String[] arrOfStr4 = pokemon4Line2.split(", ", 4);
1043 String pokemon4Line3 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon4+".txt")).get(2);
1044 String pokemon4Line4 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon4+".txt")).get(3);
1045 String detailPokemon4[] = {pokemon4Line1, arrOfStr4[0].substring(1), arrOfStr4[1], arrOfStr4[2], arrOfStr4[3].substring(0, arrOfStr4[3].length() - 1), pokemon4Line3, pokemon4Line4};
1046 DefaultTableModel tb1Mode4 = (DefaultTableModel)allPokemonTable.getModel();
1047 tb1Mode4.addRow(detailPokemon4);
1048 // find pokemon 4
1049
1050 // find pokemon 5
1051 String pokemon5Line1 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon5+".txt")).get(0);
1052 String pokemon5Line2 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon5+".txt")).get(1);
1053 String[] arrOfStr5 = pokemon5Line2.split(", ", 4);
1054 String pokemon5Line3 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon5+".txt")).get(2);
1055 String pokemon5Line4 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon5+".txt")).get(3);
1056 String detailPokemon5[] = {pokemon5Line1, arrOfStr5[0].substring(1), arrOfStr5[1], arrOfStr5[2], arrOfStr5[3].substring(0, arrOfStr5[3].length() - 1), pokemon5Line3, pokemon5Line4};
1057 DefaultTableModel tb1Mode5 = (DefaultTableModel)allPokemonTable.getModel();
1058 tb1Mode5.addRow(detailPokemon5);
1059 // find pokemon 5
1060
1061 // find pokemon 6
1062 String pokemon6Line1 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon6+".txt")).get(0);
1063 String pokemon6Line2 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon6+".txt")).get(1);
1064 String[] arrOfStr6 = pokemon6Line2.split(", ", 4);
1065 String pokemon6Line3 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon6+".txt")).get(2);
1066 String pokemon6Line4 = Files.readAllLines(Paths.get("./src/Filedata/" +pokemon6+".txt")).get(3);
1067 String detailPokemon6[] = {pokemon6Line1, arrOfStr6[0].substring(1), arrOfStr6[1], arrOfStr6[2], arrOfStr6[3].substring(0, arrOfStr6[3].length() - 1), pokemon6Line3, pokemon6Line4};
1068 DefaultTableModel tb1Mode6 = (DefaultTableModel)allPokemonTable.getModel();
1069 tb1Mode6.addRow(detailPokemon6);
1070 // find pokemon 6
1071
1072 // //System.out.println(pokemonLine2);
1073 } catch (FileNotFoundException e) {
1074 // errorTF.setText("Can't find team name!");
1075 JOptionPane.showMessageDialog(null, "Can't find team name!");
1076 //System.out.println("An error occurred.");
1077 e.printStackTrace();
1078 } catch (IOException ex) {
1079 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
1080 }
1081
1082 }
1083
1084 private void deleteButtonMouseReleased(java.awt.event.MouseEvent evt) {
1085 // TODO add your handling code here:
1086 String str = errorTF.getText();
1087 try {
1088 stringArrayTest(str);
1089 } catch (IOException ex) {
1090 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
1091 } catch (ClassNotFoundException ex) {
1092 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
1093 } catch (DecoderException ex) {
1094 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
1095 }
1096 }
1097
1098 private void saveButtonMouseReleased(java.awt.event.MouseEvent evt) {
1099 // TODO add your handling code here:
1100 String text = saveButton.getText();
1101 if(text == "")
1102 {
1103 errorTF.setText("Can't save");
1104 }
1105 else
1106 {
1107
1108 try {
1109 FileWriter myWriter = new FileWriter("./src/Team/"+ teamNameTF.getText()+".txt");
1110 myWriter.write(Arrays.toString(arrayTeam));
1111 myWriter.close();
1112 errorTF.setText("");
1113
1114 } catch (IOException e) {
1115 //System.out.println("An error occurred.");
1116 e.printStackTrace();
1117 }
1118 }
1119 }
1120
1121 private void jButton12MouseReleased(java.awt.event.MouseEvent evt) {
1122 // TODO add your handling code here:
1123
1124 // String teamname = teamNameTF.getText();
1125 String name = pokemonTF.getText();
1126 String move1 = move1TF.getText();
1127 String move2 = move2TF.getText();
1128 String move3 = move3TF.getText();
1129 String move4 = move4TF.getText();
1130 String item = itemTF.getText();
1131 String ability = abilityTF.getText();
1132
1133 if(!(name.equals("") || move1.equals("") || move2.equals("") || move3.equals("") || move4.equals("") || item.equals("") || ability.equals("")))
1134 {
1135
1136 arrayTeam[5] = name;
1137
1138 //System.out.println(Arrays.toString(arrayTeam));
1139 errorTF.setText("");
1140 PokemonSet pokemonset = new PokemonSet( name, move1, move2, move3, move4, item, ability,
1141 errorTF, pokemonTF, move1TF, move2TF, move3TF, move4TF, itemTF, abilityTF
1142 );
1143
1144 }
1145 else
1146 {
1147 errorTF.setText("Please Enter all the information!");
1148 }
1149 }
1150
1151 private void jButton11MouseReleased(java.awt.event.MouseEvent evt) {
1152 // TODO add your handling code here:
1153
1154 // String teamname = teamNameTF.getText();
1155 String name = pokemonTF.getText();
1156 String move1 = move1TF.getText();
1157 String move2 = move2TF.getText();
1158 String move3 = move3TF.getText();
1159 String move4 = move4TF.getText();
1160 String item = itemTF.getText();
1161 String ability = abilityTF.getText();
1162
1163 if(!(name.equals("") || move1.equals("") || move2.equals("") || move3.equals("") || move4.equals("") || item.equals("") || ability.equals("")))
1164 {
1165
1166 arrayTeam[4] = name;
1167
1168 //System.out.println(Arrays.toString(arrayTeam));
1169 errorTF.setText("");
1170 PokemonSet pokemonset = new PokemonSet( name, move1, move2, move3, move4, item, ability,
1171 errorTF, pokemonTF, move1TF, move2TF, move3TF, move4TF, itemTF, abilityTF
1172 );
1173
1174
1175
1176 }
1177 else
1178 {
1179 errorTF.setText("Please Enter all the information!");
1180 }
1181 }
1182
1183 private void jButton10MouseReleased(java.awt.event.MouseEvent evt) {
1184 // TODO add your handling code here:
1185
1186 // String teamname = teamNameTF.getText();
1187 String name = pokemonTF.getText();
1188 String move1 = move1TF.getText();
1189 String move2 = move2TF.getText();
1190 String move3 = move3TF.getText();
1191 String move4 = move4TF.getText();
1192 String item = itemTF.getText();
1193 String ability = abilityTF.getText();
1194
1195 if(!(name.equals("") || move1.equals("") || move2.equals("") || move3.equals("") || move4.equals("") || item.equals("") || ability.equals("")))
1196 {
1197
1198 arrayTeam[3] = name;
1199
1200 //System.out.println(Arrays.toString(arrayTeam));
1201 errorTF.setText("");
1202 PokemonSet pokemonset = new PokemonSet( name, move1, move2, move3, move4, item, ability,
1203 errorTF, pokemonTF, move1TF, move2TF, move3TF, move4TF, itemTF, abilityTF
1204 );
1205
1206
1207
1208 }
1209 else
1210 {
1211 errorTF.setText("Please Enter all the information!");
1212 }
1213 }
1214
1215 private void jButton9MouseReleased(java.awt.event.MouseEvent evt) {
1216 // TODO add your handling code here:
1217 // String teamname = teamNameTF.getText();
1218 String name = pokemonTF.getText();
1219 String move1 = move1TF.getText();
1220 String move2 = move2TF.getText();
1221 String move3 = move3TF.getText();
1222 String move4 = move4TF.getText();
1223 String item = itemTF.getText();
1224 String ability = abilityTF.getText();
1225
1226 if(!(name.equals("") || move1.equals("") || move2.equals("") || move3.equals("") || move4.equals("") || item.equals("") || ability.equals("")))
1227 {
1228
1229 arrayTeam[2] = name;
1230
1231 //System.out.println(Arrays.toString(arrayTeam));
1232 errorTF.setText("");
1233 PokemonSet pokemonset = new PokemonSet( name, move1, move2, move3, move4, item, ability,
1234 errorTF, pokemonTF, move1TF, move2TF, move3TF, move4TF, itemTF, abilityTF
1235 );
1236
1237
1238
1239 }
1240 else
1241 {
1242 errorTF.setText("Please Enter all the information!");
1243 }
1244
1245 }
1246
1247 private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
1248 // TODO add your handling code here:
1249 }
1250
1251 private void jButton8MouseReleased(java.awt.event.MouseEvent evt) {
1252 // TODO add your handling code here:
1253 // String teamname = teamNameTF.getText();
1254 String name = pokemonTF.getText();
1255 String move1 = move1TF.getText();
1256 String move2 = move2TF.getText();
1257 String move3 = move3TF.getText();
1258 String move4 = move4TF.getText();
1259 String item = itemTF.getText();
1260 String ability = abilityTF.getText();
1261
1262 if(!(name.equals("") || move1.equals("") || move2.equals("") || move3.equals("") || move4.equals("") || item.equals("") || ability.equals("")))
1263 {
1264
1265 arrayTeam[1] = name;
1266
1267 //System.out.println(Arrays.toString(arrayTeam));
1268 errorTF.setText("");
1269 PokemonSet pokemonset = new PokemonSet( name, move1, move2, move3, move4, item, ability,
1270 errorTF, pokemonTF, move1TF, move2TF, move3TF, move4TF, itemTF, abilityTF
1271 );
1272
1273
1274
1275 }
1276 else
1277 {
1278 errorTF.setText("Please Enter all the information!");
1279 }
1280 }
1281
1282 private void jButton7MouseReleased(java.awt.event.MouseEvent evt) {
1283 // TODO add your handling code here:
1284 // String teamname = teamNameTF.getText();
1285 String name = pokemonTF.getText();
1286 String move1 = move1TF.getText();
1287 String move2 = move2TF.getText();
1288 String move3 = move3TF.getText();
1289 String move4 = move4TF.getText();
1290 String item = itemTF.getText();
1291 String ability = abilityTF.getText();
1292
1293 if(!(name.equals("") || move1.equals("") || move2.equals("") || move3.equals("") || move4.equals("") || item.equals("") || ability.equals("")))
1294 {
1295
1296 arrayTeam[0] = name;
1297
1298 //System.out.println(Arrays.toString(arrayTeam));
1299 errorTF.setText("");
1300 PokemonSet pokemonset = new PokemonSet( name, move1, move2, move3, move4, item, ability,
1301 errorTF, pokemonTF, move1TF, move2TF, move3TF, move4TF, itemTF, abilityTF
1302 );
1303
1304
1305
1306 }
1307 else
1308 {
1309 errorTF.setText("Please Enter all the information!");
1310 }
1311 }
1312
1313 private void yourPokemonTFMouseReleased(java.awt.event.MouseEvent evt) {
1314
1315 }
1316
1317 private void pasteInputButtonMouseReleased(java.awt.event.MouseEvent evt) {
1318 inputTF.paste(); // TODO add your handling code here:
1319 }
1320
1321 private void possibleMovesTFActionPerformed(java.awt.event.ActionEvent evt) {
1322 // TODO add your handling code here:
1323 }
1324
1325 private void processInputButtonMouseReleased(java.awt.event.MouseEvent evt) {
1326 ArrayList<String> ArrayCounterType = new ArrayList<String>();
1327 //System.out.println(this.yourpokemonStage);
1328 //System.out.println(this.opponentpokemonStage);
1329 if(this.start_ == false)
1330 {
1331 this.opponentpokemonList = inputTF.getText();
1332
1333 // split string to 6 set
1334 String[] arrOfStr = this.opponentpokemonList.split(" / ", 6);
1335 this.pokemon1 = arrOfStr[0];
1336 this.pokemon2 = arrOfStr[1];
1337 this.pokemon3 = arrOfStr[2];
1338 this.pokemon4 = arrOfStr[3];
1339 this.pokemon5 = arrOfStr[4];
1340 this.pokemon6 = arrOfStr[5];
1341 // split string to 6 set
1342
1343 //System.out.println(this.pokemon1);
1344 pokemonStatCheckBox.addItem(this.pokemon1);
1345 pokemonStatCheckBox.addItem(this.pokemon2);
1346 pokemonStatCheckBox.addItem(this.pokemon3);
1347 pokemonStatCheckBox.addItem(this.pokemon4);
1348 pokemonStatCheckBox.addItem(this.pokemon5);
1349 pokemonStatCheckBox.addItem(this.pokemon6);
1350
1351 inputTF.setText("");
1352
1353 File f = new File("./src/Team");
1354 //System.out.println(f);
1355 File[] matchingFiles = f.listFiles(new FilenameFilter() {
1356 public boolean accept(File dir, String name) {
1357 //System.out.println(name.endsWith("txt"));
1358 return name.endsWith("txt");
1359 }
1360 });
1361
1362 for (int i=0; i<matchingFiles.length; i++)
1363 {
1364 String teamname ;
1365 String name = matchingFiles[i].toString();
1366 yourTeamComboBox.addItem(name);
1367
1368 }
1369
1370 this.start_ = true;
1371 }
1372 else
1373 {
1374
1375
1376
1377
1378
1379
1380
1381 String text = inputTF.getText();
1382 String[] words = text.split("\\s+");
1383 String keyWord = "started";
1384 //System.out.println(Arrays.toString(words));
1385
1386 if(keyWord.equals(words[1]))
1387 {
1388
1389 for (int i=0; i<words.length; i++)
1390 {
1391 if(words[i].toString().equals("Go!"))
1392 {
1393 String your = words[i+1];
1394 this.yourpokemonStage = your.substring(0, your.length() - 1 );
1395 // //System.out.println(yourpokemon);
1396
1397 ArrayList<String> arraymultiplierX4 = new ArrayList<String>();
1398 ArrayList<String> arraymultiplierX2 = new ArrayList<String>();
1399 ArrayList<String> arraymultiplierX1 = new ArrayList<String>();
1400 ArrayList<String> arraymultiplierX0 = new ArrayList<String>();
1401 ArrayList<String> arraymultiplierX05 = new ArrayList<String>();
1402 ArrayList<String> arraymultiplierX025 = new ArrayList<String>();
1403
1404 try {
1405 String pokemonType = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(4);
1406 String[] arrOfStr = pokemonType.split(",", 2);
1407 int countType = 1;
1408 int type = arrOfStr.length;
1409 // //System.out.println(arrOfStr.length);
1410 if(countType == type)
1411 {
1412
1413 String typeName1 = arrOfStr[0];
1414 String type1 = typeName1.substring(2, typeName1.length() - 2 );
1415
1416 arraymultiplierX4 = Calculator.typeCalc4(type1, null);
1417 arraymultiplierX2 = Calculator.typeCalc2(type1, null);
1418 arraymultiplierX1 = Calculator.typeCalc1(type1, null);
1419 arraymultiplierX0 = Calculator.typeCalc0(type1, null);
1420 arraymultiplierX05 = Calculator.typeCalcHalf(type1, null);
1421 arraymultiplierX025 = Calculator.typeCalcFourth(type1, null);
1422
1423 String multiplierX4 = arraymultiplierX4.toString().substring(1, arraymultiplierX4.toString().length() - 1 );
1424 String multiplierX2 = arraymultiplierX2.toString().substring(1, arraymultiplierX2.toString().length() - 1 );
1425 String multiplierX1 = arraymultiplierX1.toString().substring(1, arraymultiplierX1.toString().length() - 1 );
1426 String multiplierX0 = arraymultiplierX0.toString().substring(1, arraymultiplierX0.toString().length() - 1 );
1427 String multiplierX05 = arraymultiplierX05.toString().substring(1, arraymultiplierX05.toString().length() - 1 );
1428 String multiplierX025 = arraymultiplierX025.toString().substring(1, arraymultiplierX025.toString().length() - 1 );
1429
1430 yourWeaknessTable.setText("X4 : " + multiplierX4 + "\n" +
1431 "X2 : " + multiplierX2 + "\n" +
1432 "X1 : " + multiplierX1 + "\n" +
1433 "X0 : " + multiplierX0 + "\n" +
1434 "X0.5 : " + multiplierX05 + "\n" +
1435 "X0.25 : " + multiplierX025 + "\n" );
1436
1437 ArrayCounterType.add(type1);
1438 ArrayCounterType.add(null);
1439 }
1440 else
1441 {
1442
1443 String typeName1 = arrOfStr[0];
1444 String typeName2 = arrOfStr[1];
1445 String type1 = typeName1.substring(2, typeName1.length() - 1 );
1446 String type2 = typeName2.substring(1, typeName2.length() - 2 );
1447
1448
1449 arraymultiplierX4 = Calculator.typeCalc4(type1, type2);
1450 arraymultiplierX2 = Calculator.typeCalc2(type1, type2);
1451 arraymultiplierX1 = Calculator.typeCalc1(type1, type2);
1452 arraymultiplierX0 = Calculator.typeCalc0(type1, type2);
1453 arraymultiplierX05 = Calculator.typeCalcHalf(type1, type2);
1454 arraymultiplierX025 = Calculator.typeCalcFourth(type1, type2);
1455
1456 String multiplierX4 = arraymultiplierX4.toString().substring(1, arraymultiplierX4.toString().length() - 1 );
1457 String multiplierX2 = arraymultiplierX2.toString().substring(1, arraymultiplierX2.toString().length() - 1 );
1458 String multiplierX1 = arraymultiplierX1.toString().substring(1, arraymultiplierX1.toString().length() - 1 );
1459 String multiplierX0 = arraymultiplierX0.toString().substring(1, arraymultiplierX0.toString().length() - 1 );
1460 String multiplierX05 = arraymultiplierX05.toString().substring(1, arraymultiplierX05.toString().length() - 1 );
1461 String multiplierX025 = arraymultiplierX025.toString().substring(1, arraymultiplierX025.toString().length() - 1 );
1462
1463 yourWeaknessTable.setText("X4 : " + multiplierX4 + "\n" +
1464 "X2 : " + multiplierX2 + "\n" +
1465 "X1 : " + multiplierX1 + "\n" +
1466 "X0 : " + multiplierX0 + "\n" +
1467 "X0.5 : " + multiplierX05 + "\n" +
1468 "X0.25 : " + multiplierX025 + "\n" );
1469 ArrayCounterType.add(type1);
1470 ArrayCounterType.add(type2);
1471
1472 }
1473
1474 } catch (IOException ex) {
1475 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
1476 }
1477
1478 }
1479 else if(words[i].toString().equals("out"))
1480 {
1481
1482 String opponent = words[i+1];
1483 this.opponentpokemonStage = opponent.substring(0, opponent.length() - 1 );
1484 //System.out.println(this.opponentpokemonStage);
1485 try {
1486 String teamlist = (String) yourTeamComboBox.getSelectedItem();
1487 ArrayList<String> arr = new ArrayList<String>();
1488 File myObj = new File(teamlist);
1489 Scanner myReader = new Scanner(myObj);
1490
1491 // split string to 6 set
1492
1493 // split string to 6 set
1494
1495 // your directory
1496 File f = new File("./src/Note");
1497 File[] matchingFiles = f.listFiles(new FilenameFilter() {
1498 public boolean accept(File dir, String name) {
1499 return name.endsWith("txt");
1500 }
1501 });
1502
1503 boolean noNote = true;
1504 for(int o=0; o<matchingFiles.length; o++)
1505 {
1506 try {
1507 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(5);
1508 String yourpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
1509
1510
1511 // //System.out.println(opponentpokemon );
1512 if(this.opponentpokemonStage.equals(opponentpokemon)&&this.yourpokemonStage.equals(yourpokemon))
1513 {
1514 String notename = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(0);
1515 String adviceText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
1516 String predictText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(6);
1517 this.noteAdvice = adviceText;
1518 this.notePredict = predictText;
1519 arr.add(matchingFiles[o].toString());
1520
1521 }
1522
1523 } catch (IOException ex) {
1524 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
1525 }
1526 }
1527 if(notePredict==null){
1528 for(int o=0; o<matchingFiles.length; o++)
1529 {
1530 try {
1531 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(5);
1532
1533
1534 // //System.out.println(opponentpokemon );
1535 if(this.opponentpokemonStage.equalsIgnoreCase(opponentpokemon))
1536 {
1537 String notename = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(0);
1538 String adviceText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
1539 String predictText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(6);
1540 this.noteAdvice = adviceText;
1541 this.notePredict = predictText;
1542 arr.add(matchingFiles[o].toString());
1543 noNote = false;
1544 }
1545
1546 } catch (IOException ex) {
1547 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
1548 }
1549 }
1550 }
1551 if(noNote){
1552 //System.out.println("WRYYYYYYYYYYYYYYYYYYY");
1553
1554 this.noteAdvice = "";
1555 this.notePredict = "";
1556
1557 }
1558 }catch (FileNotFoundException e) {
1559 // errorTF.setText("Can't find team name!");
1560 JOptionPane.showMessageDialog(null, "Can't find note name!");
1561 // //System.out.println("An error occurred.");
1562 e.printStackTrace();
1563 }catch (IOException ex) {
1564 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
1565 }
1566
1567
1568
1569 JSONParser jsonParser = new JSONParser();
1570 try (FileReader reader = new FileReader("pokemon.json"))
1571 {
1572 //Read JSON file
1573 Object obj = jsonParser.parse(reader);
1574
1575 JSONArray pokemon = (JSONArray) obj;
1576
1577 pokemon.forEach( item -> {
1578 JSONObject pokemonName = (JSONObject) item;
1579 String name = (String) pokemonName.get("name");
1580
1581 if(this.opponentpokemonStage.equals(name))
1582 {
1583 ArrayList<String> arraymultiplierX4 = new ArrayList<String>();
1584 ArrayList<String> arraymultiplierX2 = new ArrayList<String>();
1585 ArrayList<String> arraymultiplierX1 = new ArrayList<String>();
1586 ArrayList<String> arraymultiplierX0 = new ArrayList<String>();
1587 ArrayList<String> arraymultiplierX05 = new ArrayList<String>();
1588 ArrayList<String> arraymultiplierX025 = new ArrayList<String>();
1589
1590
1591 String[] arrOfStr = pokemonName.get("types").toString().split(",", 2);
1592 this.opponentState = pokemonName.get("base_stats").toString();
1593
1594 int countType = 1;
1595 int type = arrOfStr.length;
1596 if(countType == type)
1597 {
1598
1599 String typeName1 = arrOfStr[0];
1600 String type1 = typeName1.substring(2, typeName1.length() - 2 );
1601
1602 arraymultiplierX4 = Calculator.typeCalc4(type1, null);
1603 arraymultiplierX2 = Calculator.typeCalc2(type1, null);
1604 arraymultiplierX1 = Calculator.typeCalc1(type1, null);
1605 arraymultiplierX0 = Calculator.typeCalc0(type1, null);
1606 arraymultiplierX05 = Calculator.typeCalcHalf(type1, null);
1607 arraymultiplierX025 = Calculator.typeCalcFourth(type1, null);
1608
1609 String multiplierX4 = arraymultiplierX4.toString().substring(1, arraymultiplierX4.toString().length() - 1 );
1610 String multiplierX2 = arraymultiplierX2.toString().substring(1, arraymultiplierX2.toString().length() - 1 );
1611 String multiplierX1 = arraymultiplierX1.toString().substring(1, arraymultiplierX1.toString().length() - 1 );
1612 String multiplierX0 = arraymultiplierX0.toString().substring(1, arraymultiplierX0.toString().length() - 1 );
1613 String multiplierX05 = arraymultiplierX05.toString().substring(1, arraymultiplierX05.toString().length() - 1 );
1614 String multiplierX025 = arraymultiplierX025.toString().substring(1, arraymultiplierX025.toString().length() - 1 );
1615
1616 opponentWeaknessTable.setText("X4 : " + multiplierX4 + "\n" +
1617 "X2 : " + multiplierX2 + "\n" +
1618 "X1 : " + multiplierX1 + "\n" +
1619 "X0 : " + multiplierX0 + "\n" +
1620 "X0.5 : " + multiplierX05 + "\n" +
1621 "X0.25 : " + multiplierX025 + "\n" );
1622 ArrayCounterType.add(type1);
1623 ArrayCounterType.add(null);
1624
1625 }
1626 else
1627 {
1628 String typeName1 = arrOfStr[0];
1629 String typeName2 = arrOfStr[1];
1630 String type1 = typeName1.substring(2, typeName1.length() - 1 );
1631 String type2 = typeName2.substring(1, typeName2.length() - 2 );
1632
1633
1634 arraymultiplierX4 = Calculator.typeCalc4(type1, type2);
1635 arraymultiplierX2 = Calculator.typeCalc2(type1, type2);
1636 arraymultiplierX1 = Calculator.typeCalc1(type1, type2);
1637 arraymultiplierX0 = Calculator.typeCalc0(type1, type2);
1638 arraymultiplierX05 = Calculator.typeCalcHalf(type1, type2);
1639 arraymultiplierX025 = Calculator.typeCalcFourth(type1, type2);
1640
1641 String multiplierX4 = arraymultiplierX4.toString().substring(1, arraymultiplierX4.toString().length() - 1 );
1642 String multiplierX2 = arraymultiplierX2.toString().substring(1, arraymultiplierX2.toString().length() - 1 );
1643 String multiplierX1 = arraymultiplierX1.toString().substring(1, arraymultiplierX1.toString().length() - 1 );
1644 String multiplierX0 = arraymultiplierX0.toString().substring(1, arraymultiplierX0.toString().length() - 1 );
1645 String multiplierX05 = arraymultiplierX05.toString().substring(1, arraymultiplierX05.toString().length() - 1 );
1646 String multiplierX025 = arraymultiplierX025.toString().substring(1, arraymultiplierX025.toString().length() - 1 );
1647
1648 opponentWeaknessTable.setText("X4 : " + multiplierX4 + "\n" +
1649 "X2 : " + multiplierX2 + "\n" +
1650 "X1 : " + multiplierX1 + "\n" +
1651 "X0 : " + multiplierX0 + "\n" +
1652 "X0.5 : " + multiplierX05 + "\n" +
1653 "X0.25 : " + multiplierX025 + "\n" );
1654
1655 ArrayCounterType.add(type1);
1656 ArrayCounterType.add(type2);
1657 }
1658 }
1659 });
1660
1661 } catch (FileNotFoundException e) {
1662 e.printStackTrace();
1663 } catch (IOException e) {
1664 e.printStackTrace();
1665 } catch (ParseException e) {
1666 e.printStackTrace();
1667 }
1668 }
1669
1670 }
1671 // check multipier 4 or 2 ?
1672 boolean lost = Calculator.typeCalcAdvantage(ArrayCounterType.get(0), ArrayCounterType.get(1), ArrayCounterType.get(2), ArrayCounterType.get(3));
1673
1674 if(lost == true)
1675 {
1676 //System.out.println("true");
1677 try {
1678 String pokemonState = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(5);
1679 // split string to 6 set
1680 String[] arrayState = pokemonState.split(",", 6);
1681 String HP = arrayState[0].substring(1);
1682 String ATK = arrayState[1];
1683 String SPA = arrayState[2];
1684 String DEF = arrayState[3];
1685 String SPD = arrayState[4];
1686 String SPE = arrayState[5].substring(0, arrayState[5].length() - 1 );
1687 // split string to 6 set
1688
1689 // split string to 6 set
1690 String[] arrayState2 = this.opponentState.split(",", 6);
1691 String opponentHP = arrayState2[0].substring(1);
1692 String opponentATK = arrayState2[1];
1693 String opponentSPA = arrayState2[2];
1694 String opponentDEF = arrayState2[3];
1695 String opponentSPD = arrayState2[4];
1696 String opponentSPE = arrayState2[5].substring(0, arrayState2[5].length() - 1 );
1697 // split string to 6 set
1698
1699 if(Integer.parseInt(SPE) > Integer.parseInt(opponentSPE)) ///// แก้กลับ >
1700 {
1701 if(Integer.parseInt(ATK) >= 100)
1702 {
1703 if(Integer.parseInt(opponentDEF) > 80 )
1704 {
1705 if(this.pokemon1.equals(this.opponentpokemonStage))
1706 {
1707 if(this.health7 < 50)
1708 {
1709 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
1710 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
1711 }
1712 else
1713 {
1714 //System.out.println("7");
1715 ArrayList<String> arraylistMove = new ArrayList<String>();
1716 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
1717 // split string to 6 set
1718 String[] arrayMove = pokemonMove.split(", ", 4);
1719 arraylistMove.add(arrayMove[0].substring(1));
1720 arraylistMove.add(arrayMove[1]);
1721 arraylistMove.add(arrayMove[2]);
1722 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
1723 // split string to 6 set
1724
1725 //System.out.println("For Loop check have move U-turn ?");
1726 for (int counter = 0; counter < arraylistMove.size(); counter++) {
1727 //System.out.println(arraylistMove.get(counter));
1728 if(arraylistMove.get(counter).equals("U-turn"))
1729 {
1730
1731 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
1732 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
1733
1734
1735 }
1736 else
1737 {
1738 if(arraylistMove.get(counter).equals("Volt Switch"))
1739 {
1740
1741 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
1742 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
1743
1744
1745 }
1746 else
1747 {
1748
1749 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
1750 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
1751
1752 }
1753 }
1754 }
1755 }
1756 }
1757 else if(this.pokemon2.equals(this.opponentpokemonStage))
1758 {
1759 if(this.health8 < 50)
1760 {
1761 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
1762 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
1763 }
1764 else
1765 {
1766 ArrayList<String> arraylistMove = new ArrayList<String>();
1767 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
1768 // split string to 6 set
1769 String[] arrayMove = this.opponentState.split(", ", 4);
1770 arraylistMove.add(arrayMove[0].substring(1));
1771 arraylistMove.add(arrayMove[1]);
1772 arraylistMove.add(arrayMove[2]);
1773 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
1774 // split string to 6 set
1775
1776 //System.out.println("For Loop check have move U-turn ?");
1777 for (int counter = 0; counter < arraylistMove.size(); counter++) {
1778 //System.out.println(arraylistMove.get(counter));
1779 if(arraylistMove.get(counter).equals("U-turn"))
1780 {
1781 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
1782 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1783 }
1784 else
1785 {
1786 if(arraylistMove.get(counter).equals("Volt Switch"))
1787 {
1788 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
1789 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1790 }
1791 else
1792 {
1793 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
1794 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1795 }
1796 }
1797 }
1798 }
1799 }
1800 else if(this.pokemon3.equals(this.opponentpokemonStage))
1801 {
1802 if(this.health9 < 50)
1803 {
1804 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
1805 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
1806 }
1807 else
1808 {
1809 ArrayList<String> arraylistMove = new ArrayList<String>();
1810 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
1811 // split string to 6 set
1812 String[] arrayMove = this.opponentState.split(", ", 4);
1813 arraylistMove.add(arrayMove[0].substring(1));
1814 arraylistMove.add(arrayMove[1]);
1815 arraylistMove.add(arrayMove[2]);
1816 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
1817 // split string to 6 set
1818
1819 //System.out.println("For Loop check have move U-turn ?");
1820 for (int counter = 0; counter < arraylistMove.size(); counter++) {
1821 //System.out.println(arraylistMove.get(counter));
1822 if(arraylistMove.get(counter).equals("U-turn"))
1823 {
1824 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
1825 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1826 }
1827 else
1828 {
1829 if(arraylistMove.get(counter).equals("Volt Switch"))
1830 {
1831 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
1832 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1833 }
1834 else
1835 {
1836 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
1837 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1838 }
1839 }
1840 }
1841 }
1842 }
1843 else if(this.pokemon4.equals(this.opponentpokemonStage))
1844 {
1845 if(this.health10 < 50)
1846 {
1847 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
1848 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
1849 }
1850 else
1851 {
1852 ArrayList<String> arraylistMove = new ArrayList<String>();
1853 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
1854 // split string to 6 set
1855 String[] arrayMove = this.opponentState.split(", ", 4);
1856 arraylistMove.add(arrayMove[0].substring(1));
1857 arraylistMove.add(arrayMove[1]);
1858 arraylistMove.add(arrayMove[2]);
1859 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
1860 // split string to 6 set
1861
1862 //System.out.println("For Loop check have move U-turn ?");
1863 for (int counter = 0; counter < arraylistMove.size(); counter++) {
1864 //System.out.println(arraylistMove.get(counter));
1865 if(arraylistMove.get(counter).equals("U-turn"))
1866 {
1867 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
1868 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1869 }
1870 else
1871 {
1872 if(arraylistMove.get(counter).equals("Volt Switch"))
1873 {
1874 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
1875 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1876 }
1877 else
1878 {
1879 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
1880 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1881 }
1882 }
1883 }
1884 }
1885 }
1886 else if(this.pokemon5.equals(this.opponentpokemonStage))
1887 {
1888 if(this.health11 < 50)
1889 {
1890 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
1891 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
1892 }
1893 else
1894 {
1895 ArrayList<String> arraylistMove = new ArrayList<String>();
1896 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
1897 // split string to 6 set
1898 String[] arrayMove = this.opponentState.split(", ", 4);
1899 arraylistMove.add(arrayMove[0].substring(1));
1900 arraylistMove.add(arrayMove[1]);
1901 arraylistMove.add(arrayMove[2]);
1902 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
1903 // split string to 6 set
1904
1905 //System.out.println("For Loop check have move U-turn ?");
1906 for (int counter = 0; counter < arraylistMove.size(); counter++) {
1907 //System.out.println(arraylistMove.get(counter));
1908 if(arraylistMove.get(counter).equals("U-turn"))
1909 {
1910 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
1911 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1912 }
1913 else
1914 {
1915 if(arraylistMove.get(counter).equals("Volt Switch"))
1916 {
1917 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
1918 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1919 }
1920 else
1921 {
1922 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
1923 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1924 }
1925 }
1926 }
1927 }
1928 }
1929 else if(this.pokemon6.equals(this.opponentpokemonStage))
1930 {
1931 if(this.health12 < 50)
1932 {
1933 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
1934 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
1935 }
1936 else
1937 {
1938 ArrayList<String> arraylistMove = new ArrayList<String>();
1939 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
1940 // split string to 6 set
1941 String[] arrayMove = this.opponentState.split(", ", 4);
1942 arraylistMove.add(arrayMove[0].substring(1));
1943 arraylistMove.add(arrayMove[1]);
1944 arraylistMove.add(arrayMove[2]);
1945 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
1946 // split string to 6 set
1947
1948 //System.out.println("For Loop check have move U-turn ?");
1949 for (int counter = 0; counter < arraylistMove.size(); counter++) {
1950 //System.out.println(arraylistMove.get(counter));
1951 if(arraylistMove.get(counter).equals("U-turn"))
1952 {
1953 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
1954 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1955 }
1956 else
1957 {
1958 if(arraylistMove.get(counter).equals("Volt Switch"))
1959 {
1960 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
1961 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1962 }
1963 else
1964 {
1965 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
1966 yourPredictionNextMoveTF.setText(this.notePredict + "\n" +"They will probably attack it");
1967 }
1968 }
1969 }
1970 }
1971 }
1972 }
1973 else
1974 {
1975 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
1976 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
1977 }
1978 }
1979 else
1980 {
1981 if(Integer.parseInt(opponentSPD) > 80 )
1982 {
1983 if(this.pokemon1.equals(this.opponentpokemonStage))
1984 {
1985 if(this.health7 < 50)
1986 {
1987 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
1988 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
1989 }
1990 else
1991 {
1992 //System.out.println("7");
1993 ArrayList<String> arraylistMove = new ArrayList<String>();
1994 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
1995 // split string to 6 set
1996 String[] arrayMove = this.opponentState.split(", ", 4);
1997 arraylistMove.add(arrayMove[0].substring(1));
1998 arraylistMove.add(arrayMove[1]);
1999 arraylistMove.add(arrayMove[2]);
2000 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
2001 // split string to 6 set
2002
2003 //System.out.println("For Loop check have move U-turn ?");
2004 for (int counter = 0; counter < arraylistMove.size(); counter++) {
2005 //System.out.println(arraylistMove.get(counter));
2006 if(arraylistMove.get(counter).equals("U-turn"))
2007 {
2008 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
2009 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2010 }
2011 else
2012 {
2013 if(arraylistMove.get(counter).equals("Volt Switch"))
2014 {
2015 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
2016 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2017 }
2018 else
2019 {
2020 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
2021 yourPredictionNextMoveTF.setText("They will probably attack it");
2022 }
2023 }
2024 }
2025 }
2026 }
2027 else if(this.pokemon2.equals(this.opponentpokemonStage))
2028 {
2029 if(this.health8 < 50)
2030 {
2031 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
2032 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
2033 }
2034 else
2035 {
2036 ArrayList<String> arraylistMove = new ArrayList<String>();
2037 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
2038 // split string to 6 set
2039 String[] arrayMove = this.opponentState.split(", ", 4);
2040 arraylistMove.add(arrayMove[0].substring(1));
2041 arraylistMove.add(arrayMove[1]);
2042 arraylistMove.add(arrayMove[2]);
2043 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
2044 // split string to 6 set
2045
2046 //System.out.println("For Loop check have move U-turn ?");
2047 for (int counter = 0; counter < arraylistMove.size(); counter++) {
2048 //System.out.println(arraylistMove.get(counter));
2049 if(arraylistMove.get(counter).equals("U-turn"))
2050 {
2051 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
2052 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2053 }
2054 else
2055 {
2056 if(arraylistMove.get(counter).equals("Volt Switch"))
2057 {
2058 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
2059 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2060 }
2061 else
2062 {
2063 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
2064 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2065 }
2066 }
2067 }
2068 }
2069 }
2070 else if(this.pokemon3.equals(this.opponentpokemonStage))
2071 {
2072 if(this.health9 < 50)
2073 {
2074 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
2075 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
2076 }
2077 else
2078 {
2079 ArrayList<String> arraylistMove = new ArrayList<String>();
2080 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
2081 // split string to 6 set
2082 String[] arrayMove = this.opponentState.split(", ", 4);
2083 arraylistMove.add(arrayMove[0].substring(1));
2084 arraylistMove.add(arrayMove[1]);
2085 arraylistMove.add(arrayMove[2]);
2086 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
2087 // split string to 6 set
2088
2089 //System.out.println("For Loop check have move U-turn ?");
2090 for (int counter = 0; counter < arraylistMove.size(); counter++) {
2091 //System.out.println(arraylistMove.get(counter));
2092 if(arraylistMove.get(counter).equals("U-turn"))
2093 {
2094 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
2095 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2096 }
2097 else
2098 {
2099 if(arraylistMove.get(counter).equals("Volt Switch"))
2100 {
2101 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
2102 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2103 }
2104 else
2105 {
2106 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
2107 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2108 }
2109 }
2110 }
2111 }
2112 }
2113 else if(this.pokemon4.equals(this.opponentpokemonStage))
2114 {
2115 if(this.health10 < 50)
2116 {
2117 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
2118 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
2119 }
2120 else
2121 {
2122 ArrayList<String> arraylistMove = new ArrayList<String>();
2123 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
2124 // split string to 6 set
2125 String[] arrayMove = this.opponentState.split(", ", 4);
2126 arraylistMove.add(arrayMove[0].substring(1));
2127 arraylistMove.add(arrayMove[1]);
2128 arraylistMove.add(arrayMove[2]);
2129 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
2130 // split string to 6 set
2131
2132 //System.out.println("For Loop check have move U-turn ?");
2133 for (int counter = 0; counter < arraylistMove.size(); counter++) {
2134 //System.out.println(arraylistMove.get(counter));
2135 if(arraylistMove.get(counter).equals("U-turn"))
2136 {
2137 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
2138 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2139 }
2140 else
2141 {
2142 if(arraylistMove.get(counter).equals("Volt Switch"))
2143 {
2144 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
2145 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2146 }
2147 else
2148 {
2149 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" +"Switch to a pokemon will type advantage");
2150 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2151 }
2152 }
2153 }
2154 }
2155 }
2156 else if(this.pokemon5.equals(this.opponentpokemonStage))
2157 {
2158 if(this.health11 < 50)
2159 {
2160 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
2161 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
2162 }
2163 else
2164 {
2165 ArrayList<String> arraylistMove = new ArrayList<String>();
2166 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
2167 // split string to 6 set
2168 String[] arrayMove = this.opponentState.split(", ", 4);
2169 arraylistMove.add(arrayMove[0].substring(1));
2170 arraylistMove.add(arrayMove[1]);
2171 arraylistMove.add(arrayMove[2]);
2172 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
2173 // split string to 6 set
2174
2175 //System.out.println("For Loop check have move U-turn ?");
2176 for (int counter = 0; counter < arraylistMove.size(); counter++) {
2177 //System.out.println(arraylistMove.get(counter));
2178 if(arraylistMove.get(counter).equals("U-turn"))
2179 {
2180 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
2181 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2182 }
2183 else
2184 {
2185 if(arraylistMove.get(counter).equals("Volt Switch"))
2186 {
2187 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
2188 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2189 }
2190 else
2191 {
2192 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
2193 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2194 }
2195 }
2196 }
2197 }
2198 }
2199 else if(this.pokemon6.equals(this.opponentpokemonStage))
2200 {
2201 if(this.health12 < 50)
2202 {
2203 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
2204 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
2205 }
2206 else
2207 {
2208 ArrayList<String> arraylistMove = new ArrayList<String>();
2209 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
2210 // split string to 6 set
2211 String[] arrayMove = this.opponentState.split(", ", 4);
2212 arraylistMove.add(arrayMove[0].substring(1));
2213 arraylistMove.add(arrayMove[1]);
2214 arraylistMove.add(arrayMove[2]);
2215 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
2216 // split string to 6 set
2217
2218 //System.out.println("For Loop check have move U-turn ?");
2219 for (int counter = 0; counter < arraylistMove.size(); counter++) {
2220 //System.out.println(arraylistMove.get(counter));
2221 if(arraylistMove.get(counter).equals("U-turn"))
2222 {
2223 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
2224 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2225 }
2226 else
2227 {
2228 if(arraylistMove.get(counter).equals("Volt Switch"))
2229 {
2230 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
2231 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2232 }
2233 else
2234 {
2235 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
2236 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
2237 }
2238 }
2239 }
2240 }
2241 }
2242 }
2243 else
2244 {
2245 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
2246 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
2247 }
2248 }
2249
2250
2251 }
2252 else
2253 {
2254 if(importantPokemonTF.getText().equals(""))
2255 {
2256 if(Integer.parseInt(opponentATK) > Integer.parseInt(opponentSPA))
2257 {
2258 if(Integer.parseInt(DEF) >= 100)
2259 {
2260 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
2261 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
2262 }
2263 else
2264 {
2265 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
2266 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
2267 }
2268 }
2269 else
2270 {
2271 if(Integer.parseInt(SPD) >= 100)
2272 {
2273 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
2274 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
2275 }
2276 else
2277 {
2278 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
2279 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
2280 }
2281 }
2282 }
2283 else
2284 {
2285 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to some unimportant Pokemon");
2286 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
2287 }
2288 }
2289 } catch (IOException ex) {
2290 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2291 }
2292 }
2293 else
2294 {
2295 // multipier not 4 or 2
2296 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use any attack that would deal the most damage to the Pokemon");
2297 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent might switch their Pokemon, but it's fine either way");
2298
2299
2300 }
2301
2302 inputTF.setText("");
2303
2304 }
2305 else
2306 {
2307 // check first word == the opposing ?
2308 //System.out.println("check first word == the opposing ?" );
2309 String textText = "The";
2310 if(textText.equals(words[0]))
2311 {
2312 //System.out.println("the ...");
2313 if(words[2].equals(this.opponentpokemonStage))
2314 {
2315 //System.out.println("hit opponent");
2316 for (int i=0; i<words.length; i++)
2317 {
2318 if(words[i].toString().equals("lost"))
2319 {
2320 String name = words[i-1].substring(1);
2321 if(name.equals(this.yourpokemonStage))
2322 {
2323 //System.out.println("The " + name);
2324 try {
2325 Object item = yourTeamComboBox.getSelectedItem();
2326 String search = (String) item;
2327
2328 String pokemonName = Files.readAllLines(Paths.get(search)).get(0);
2329 //System.out.println(pokemonName);
2330
2331 // split string to 6 set
2332 String[] arrOfStr = pokemonName.split(", ", 6);
2333 String pokemon1 = arrOfStr[0].substring(1);
2334 String pokemon2 = arrOfStr[1];
2335 String pokemon3 = arrOfStr[2];
2336 String pokemon4 = arrOfStr[3];
2337 String pokemon5 = arrOfStr[4];
2338 String pokemon6 = arrOfStr[5].substring(0, arrOfStr[5].length() - 1 );
2339 // split string to 6 set
2340 if(this.yourpokemonStage.equals(pokemon1))
2341 {
2342 String hpLost = words[i+1];
2343 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2344 this.health1 = (this.health1 - Integer.parseInt(Lost));
2345 //System.out.println(this.health1);
2346 }
2347 else if(this.yourpokemonStage.equals(pokemon2))
2348 {
2349 String hpLost = words[i+1];
2350 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2351 this.health2 = (this.health2 - Integer.parseInt(Lost));
2352 //System.out.println(this.health2);
2353 }
2354 else if(this.yourpokemonStage.equals(pokemon3))
2355 {
2356 String hpLost = words[i+1];
2357 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2358 this.health3 = (this.health3 - Integer.parseInt(Lost));
2359 //System.out.println(this.health3);
2360 }
2361 else if(this.yourpokemonStage.equals(pokemon4))
2362 {
2363 String hpLost = words[i+1];
2364 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2365 this.health4 = (this.health4 - Integer.parseInt(Lost));
2366 //System.out.println(this.health4);
2367 }
2368 else if(this.yourpokemonStage.equals(pokemon5))
2369 {
2370 String hpLost = words[i+1];
2371 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2372 this.health5 = (this.health5 - Integer.parseInt(Lost));
2373 //System.out.println(this.health5);
2374 }
2375 else if(this.yourpokemonStage.equals(pokemon6))
2376 {
2377 String hpLost = words[i+1];
2378 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2379 this.health6 = (this.health6 - Integer.parseInt(Lost));
2380 //System.out.println(this.health6);
2381 }
2382 } catch (IOException ex) {
2383 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2384 }
2385
2386 }
2387 else if(words[i-1].toString().equals(this.opponentpokemonStage))
2388 {
2389 if(this.pokemon1.equals(this.opponentpokemonStage))
2390 {
2391 String hpLost = words[i+1];
2392 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2393 this.health7 = (this.health7 - Integer.parseInt(Lost));
2394 //System.out.println(this.health7);
2395 }
2396 else if(this.pokemon1.equals(this.opponentpokemonStage))
2397 {
2398 String hpLost = words[i+1];
2399 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2400 this.health8 = (this.health8 - Integer.parseInt(Lost));
2401 //System.out.println(this.health8);
2402 }
2403 else if(this.pokemon2.equals(this.opponentpokemonStage))
2404 {
2405 String hpLost = words[i+1];
2406 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2407 this.health9 = (this.health9 - Integer.parseInt(Lost));
2408 //System.out.println(this.health9);
2409 }
2410 else if(this.pokemon3.equals(this.opponentpokemonStage))
2411 {
2412 String hpLost = words[i+1];
2413 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2414 this.health10 = (this.health10 - Integer.parseInt(Lost));
2415 //System.out.println(this.health10);
2416 }
2417 else if(this.pokemon4.equals(this.opponentpokemonStage))
2418 {
2419 String hpLost = words[i+1];
2420 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2421 this.health11 = (this.health11 - Integer.parseInt(Lost));
2422 //System.out.println(this.health11);
2423 }
2424 else if(this.pokemon5.equals(this.opponentpokemonStage))
2425 {
2426 String hpLost = words[i+1];
2427 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2428 this.health12 = (this.health12 - Integer.parseInt(Lost));
2429 //System.out.println(this.health12);
2430 }
2431 }
2432
2433 }
2434 else
2435 {
2436 if(words[i].toString().equals("out"))
2437 {
2438 //System.out.println(words[i+1]);
2439 String opponent = words[i+1];
2440 this.opponentpokemonStage = opponent.substring(0, opponent.length() - 1 );
2441 try {
2442 String teamlist = (String) yourTeamComboBox.getSelectedItem();
2443 ArrayList<String> arr = new ArrayList<String>();
2444 File myObj = new File(teamlist);
2445 Scanner myReader = new Scanner(myObj);
2446
2447 // split string to 6 set
2448
2449 // split string to 6 set
2450
2451 // your directory
2452 File f = new File("./src/Note");
2453 File[] matchingFiles = f.listFiles(new FilenameFilter() {
2454 public boolean accept(File dir, String name) {
2455 return name.endsWith("txt");
2456 }
2457 });
2458
2459 boolean noNote = true;
2460 for(int o=0; o<matchingFiles.length; o++)
2461 {
2462 try {
2463 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(5);
2464 String yourpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
2465
2466
2467 // //System.out.println(opponentpokemon );
2468 if(this.opponentpokemonStage.equals(opponentpokemon)&&this.yourpokemonStage.equals(yourpokemon))
2469 {
2470 String notename = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(0);
2471 String adviceText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
2472 String predictText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(6);
2473 this.noteAdvice = adviceText;
2474 this.notePredict = predictText;
2475 arr.add(matchingFiles[o].toString());
2476
2477 }
2478
2479 } catch (IOException ex) {
2480 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2481 }
2482 }
2483 if(notePredict==null){
2484 for(int o=0; o<matchingFiles.length; o++)
2485 {
2486 try {
2487 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(5);
2488
2489
2490 // //System.out.println(opponentpokemon );
2491 if(this.opponentpokemonStage.equalsIgnoreCase(opponentpokemon))
2492 {
2493 String notename = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(0);
2494 String adviceText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
2495 String predictText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(6);
2496 this.noteAdvice = adviceText;
2497 this.notePredict = predictText;
2498 arr.add(matchingFiles[o].toString());
2499 noNote = false;
2500 }
2501
2502 } catch (IOException ex) {
2503 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2504 }
2505 }
2506 }
2507 if(noNote){
2508 //System.out.println("WRYYYYYYYYYYYYYYYYYYY");
2509
2510 this.noteAdvice = "";
2511 this.notePredict = "";
2512
2513 }
2514 }catch (FileNotFoundException e) {
2515 // errorTF.setText("Can't find team name!");
2516 JOptionPane.showMessageDialog(null, "Can't find note name!");
2517 // //System.out.println("An error occurred.");
2518 e.printStackTrace();
2519 }catch (IOException ex) {
2520 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2521 }
2522 }
2523 else if(words[i].toString().equals("Go!"))
2524 {
2525
2526 //System.out.println(words[i+1]);
2527 String your = words[i+1];
2528 this.yourpokemonStage = your.substring(0, your.length() - 1 );
2529
2530 }
2531 }
2532 }
2533 }
2534 }
2535 else
2536 {
2537 //System.out.println("check first word == your pokemon ?" );
2538 String pokemonName = words[0].substring(0, words[0].length() - 1 );
2539 String PokemonNameUse = words[0];
2540 if(pokemonName.equals(this.yourpokemonStage) || PokemonNameUse.equals(this.yourpokemonStage))
2541 {
2542 if(words[1].equals("come"))
2543 {
2544 //System.out.println("come back");
2545 for (int i=0; i<words.length; i++)
2546 {
2547 if(words[i].toString().equals("Go!"))
2548 {
2549 String yourpokemon = words[i+1];
2550 this.yourpokemonStage = yourpokemon.substring(0, yourpokemon.length() - 1 );
2551 //System.out.println("go " + this.yourpokemonStage);
2552 }
2553 else if(words[i].toString().equals("lost"))
2554 {
2555 String name = words[i-1].substring(1);
2556 //System.out.println(name);
2557 if(name.equals(this.yourpokemonStage))
2558 {
2559 //System.out.println("your ");
2560 try {
2561 Object item = yourTeamComboBox.getSelectedItem();
2562 String search = (String) item;
2563
2564 String pokemonName2 = Files.readAllLines(Paths.get(search)).get(0);
2565 //System.out.println(pokemonName2);
2566
2567 // split string to 6 set
2568 String[] arrOfStr = pokemonName2.split(", ", 6);
2569 String pokemon1 = arrOfStr[0].substring(1);
2570 String pokemon2 = arrOfStr[1];
2571 String pokemon3 = arrOfStr[2];
2572 String pokemon4 = arrOfStr[3];
2573 String pokemon5 = arrOfStr[4];
2574 String pokemon6 = arrOfStr[5].substring(0, arrOfStr[5].length() - 1 );
2575 // split string to 6 set
2576 if(this.yourpokemonStage.equals(pokemon1))
2577 {
2578 String hpLost = words[i+1];
2579 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2580 this.health1 = (this.health1 - Integer.parseInt(Lost));
2581 //System.out.println(this.health1);
2582 }
2583 else if(this.yourpokemonStage.equals(pokemon2))
2584 {
2585 String hpLost = words[i+1];
2586 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2587 this.health2 = (this.health2 - Integer.parseInt(Lost));
2588 //System.out.println(this.health2);
2589 }
2590 else if(this.yourpokemonStage.equals(pokemon3))
2591 {
2592 String hpLost = words[i+1];
2593 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2594 this.health3 = (this.health3 - Integer.parseInt(Lost));
2595 //System.out.println(this.health3);
2596 }
2597 else if(this.yourpokemonStage.equals(pokemon4))
2598 {
2599 String hpLost = words[i+1];
2600 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2601 this.health4 = (this.health4 - Integer.parseInt(Lost));
2602 //System.out.println(this.health4);
2603 }
2604 else if(this.yourpokemonStage.equals(pokemon5))
2605 {
2606 String hpLost = words[i+1];
2607 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2608 this.health5 = (this.health5 - Integer.parseInt(Lost));
2609 //System.out.println(this.health5);
2610 }
2611 else if(this.yourpokemonStage.equals(pokemon6))
2612 {
2613 String hpLost = words[i+1];
2614 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2615 this.health6 = (this.health6 - Integer.parseInt(Lost));
2616 //System.out.println(this.health6);
2617 }
2618 } catch (IOException ex) {
2619 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2620 }
2621 }
2622 else if(words[i-1].toString().equals(this.opponentpokemonStage))
2623 {
2624 //System.out.println("opponant");
2625 if(this.pokemon1.equals(this.opponentpokemonStage))
2626 {
2627 String hpLost = words[i+1];
2628 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2629 this.health7 = (this.health7 - Integer.parseInt(Lost));
2630 //System.out.println(this.health7);
2631 }
2632 else if(this.pokemon1.equals(this.opponentpokemonStage))
2633 {
2634 String hpLost = words[i+1];
2635 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2636 this.health8 = (this.health8 - Integer.parseInt(Lost));
2637 //System.out.println(this.health8);
2638 }
2639 else if(this.pokemon2.equals(this.opponentpokemonStage))
2640 {
2641 String hpLost = words[i+1];
2642 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2643 this.health9 = (this.health9 - Integer.parseInt(Lost));
2644 //System.out.println(this.health9);
2645 }
2646 else if(this.pokemon3.equals(this.opponentpokemonStage))
2647 {
2648 String hpLost = words[i+1];
2649 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2650 this.health10 = (this.health10 - Integer.parseInt(Lost));
2651 //System.out.println(this.health10);
2652 }
2653 else if(this.pokemon4.equals(this.opponentpokemonStage))
2654 {
2655 String hpLost = words[i+1];
2656 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2657 this.health11 = (this.health11 - Integer.parseInt(Lost));
2658 //System.out.println(this.health11);
2659 }
2660 else if(this.pokemon5.equals(this.opponentpokemonStage))
2661 {
2662 String hpLost = words[i+1];
2663 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2664 this.health12 = (this.health12 - Integer.parseInt(Lost));
2665 //System.out.println(this.health12);
2666 }
2667 }
2668
2669 }
2670
2671 }
2672 }
2673 else if(words[1].equals("used"))
2674 {
2675 //System.out.println("USED");
2676 for (int i=0; i<words.length; i++)
2677 {
2678 if(words[i].toString().equals("lost"))
2679 {
2680 String name = words[i-1].substring(1);
2681 //System.out.println(words[i-1]);
2682 if(name.equals(this.yourpokemonStage))
2683 {
2684 try {
2685 Object item = yourTeamComboBox.getSelectedItem();
2686 String search = (String) item;
2687
2688 String pokemonName2 = Files.readAllLines(Paths.get(search)).get(0);
2689 //System.out.println(pokemonName2);
2690
2691 // split string to 6 set
2692 String[] arrOfStr = pokemonName2.split(", ", 6);
2693 String pokemon1 = arrOfStr[0].substring(1);
2694 String pokemon2 = arrOfStr[1];
2695 String pokemon3 = arrOfStr[2];
2696 String pokemon4 = arrOfStr[3];
2697 String pokemon5 = arrOfStr[4];
2698 String pokemon6 = arrOfStr[5].substring(0, arrOfStr[5].length() - 1 );
2699 // split string to 6 set
2700 if(this.yourpokemonStage.equals(pokemon1))
2701 {
2702 String hpLost = words[i+1];
2703 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2704 this.health1 = (this.health1 - Integer.parseInt(Lost));
2705 //System.out.println(this.health1);
2706 }
2707 else if(this.yourpokemonStage.equals(pokemon2))
2708 {
2709 String hpLost = words[i+1];
2710 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2711 this.health2 = (this.health2 - Integer.parseInt(Lost));
2712 //System.out.println(this.health2);
2713 }
2714 else if(this.yourpokemonStage.equals(pokemon3))
2715 {
2716 String hpLost = words[i+1];
2717 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2718 this.health3 = (this.health3 - Integer.parseInt(Lost));
2719 //System.out.println(this.health3);
2720 }
2721 else if(this.yourpokemonStage.equals(pokemon4))
2722 {
2723 String hpLost = words[i+1];
2724 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2725 this.health4 = (this.health4 - Integer.parseInt(Lost));
2726 //System.out.println(this.health4);
2727 }
2728 else if(this.yourpokemonStage.equals(pokemon5))
2729 {
2730 String hpLost = words[i+1];
2731 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2732 this.health5 = (this.health5 - Integer.parseInt(Lost));
2733 //System.out.println(this.health5);
2734 }
2735 else if(this.yourpokemonStage.equals(pokemon6))
2736 {
2737 String hpLost = words[i+1];
2738 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2739 this.health6 = (this.health6 - Integer.parseInt(Lost));
2740 //System.out.println(this.health6);
2741 }
2742 } catch (IOException ex) {
2743 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2744 }
2745
2746 }
2747 else if(words[i-1].equals(this.opponentpokemonStage))
2748 {
2749 if(this.pokemon1.equals(this.opponentpokemonStage))
2750 {
2751 String hpLost = words[i+1];
2752 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2753 this.health7 = (this.health7 - Integer.parseInt(Lost));
2754 //System.out.println(this.health7);
2755 }
2756 else if(this.pokemon1.equals(this.opponentpokemonStage))
2757 {
2758 String hpLost = words[i+1];
2759 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2760 this.health8 = (this.health8 - Integer.parseInt(Lost));
2761 //System.out.println(this.health8);
2762 }
2763 else if(this.pokemon2.equals(this.opponentpokemonStage))
2764 {
2765 String hpLost = words[i+1];
2766 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2767 this.health9 = (this.health9 - Integer.parseInt(Lost));
2768 //System.out.println(this.health9);
2769 }
2770 else if(this.pokemon3.equals(this.opponentpokemonStage))
2771 {
2772 String hpLost = words[i+1];
2773 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2774 this.health10 = (this.health10 - Integer.parseInt(Lost));
2775 //System.out.println(this.health10);
2776 }
2777 else if(this.pokemon4.equals(this.opponentpokemonStage))
2778 {
2779 String hpLost = words[i+1];
2780 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2781 this.health11 = (this.health11 - Integer.parseInt(Lost));
2782 //System.out.println(this.health11);
2783 }
2784 else if(this.pokemon5.equals(this.opponentpokemonStage))
2785 {
2786 String hpLost = words[i+1];
2787 String Lost = hpLost.substring(0, hpLost.length() - 1 );
2788 this.health12 = (this.health12 - Integer.parseInt(Lost));
2789 //System.out.println(this.health12);
2790 }
2791 }
2792
2793 }
2794 else
2795 {
2796 if(words[i].toString().equals("out"))
2797 {
2798 //System.out.println(words[i+1]);
2799 String opponent = words[i+1];
2800 this.opponentpokemonStage = opponent.substring(0, opponent.length() - 1 );
2801 try {
2802 String teamlist = (String) yourTeamComboBox.getSelectedItem();
2803 ArrayList<String> arr = new ArrayList<String>();
2804 File myObj = new File(teamlist);
2805 Scanner myReader = new Scanner(myObj);
2806
2807 // split string to 6 set
2808
2809 // split string to 6 set
2810
2811 // your directory
2812 File f = new File("./src/Note");
2813 File[] matchingFiles = f.listFiles(new FilenameFilter() {
2814 public boolean accept(File dir, String name) {
2815 return name.endsWith("txt");
2816 }
2817 });
2818
2819 boolean noNote = true;
2820 for(int o=0; o<matchingFiles.length; o++)
2821 {
2822 try {
2823 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(5);
2824 String yourpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
2825
2826
2827 // //System.out.println(opponentpokemon );
2828 if(this.opponentpokemonStage.equals(opponentpokemon)&&this.yourpokemonStage.equals(yourpokemon))
2829 {
2830 String notename = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(0);
2831 String adviceText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
2832 String predictText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(6);
2833 this.noteAdvice = adviceText;
2834 this.notePredict = predictText;
2835 arr.add(matchingFiles[o].toString());
2836
2837 }
2838
2839 } catch (IOException ex) {
2840 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2841 }
2842 }
2843 if(notePredict==null){
2844 for(int o=0; o<matchingFiles.length; o++)
2845 {
2846 try {
2847 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(5);
2848
2849
2850 // //System.out.println(opponentpokemon );
2851 if(this.opponentpokemonStage.equalsIgnoreCase(opponentpokemon))
2852 {
2853 String notename = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(0);
2854 String adviceText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
2855 String predictText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(6);
2856 this.noteAdvice = adviceText;
2857 this.notePredict = predictText;
2858 arr.add(matchingFiles[o].toString());
2859 noNote = false;
2860 }
2861
2862 } catch (IOException ex) {
2863 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2864 }
2865 }
2866 }
2867 if(noNote){
2868 //System.out.println("WRYYYYYYYYYYYYYYYYYYY");
2869
2870 this.noteAdvice = "";
2871 this.notePredict = "";
2872
2873 }
2874 }catch (FileNotFoundException e) {
2875 // errorTF.setText("Can't find team name!");
2876 JOptionPane.showMessageDialog(null, "Can't find note name!");
2877 // //System.out.println("An error occurred.");
2878 e.printStackTrace();
2879 }catch (IOException ex) {
2880 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2881 }
2882 }
2883 else if(words[i].toString().equals("Go!"))
2884 {
2885
2886 //System.out.println(words[i+1]);
2887 String your = words[i+1];
2888 this.yourpokemonStage = your.substring(0, your.length() - 1 );
2889
2890 }
2891 }
2892 }
2893 }
2894 }
2895 else
2896 {
2897 //System.out.println("if opponent switch pokemon");
2898 String opponentSwitch = words[1];
2899 if(opponentSwitch.equals("withdrew"))
2900 {
2901 for (int i=0; i<words.length; i++)
2902 {
2903 if(words[i].toString().equals("out"))
2904 {
2905 //System.out.println("send out " + words[i+1]);
2906 String opponent = words[i+1];
2907 this.opponentpokemonStage = opponent.substring(0, opponent.length() - 1 );
2908 try {
2909 String teamlist = (String) yourTeamComboBox.getSelectedItem();
2910 ArrayList<String> arr = new ArrayList<String>();
2911 File myObj = new File(teamlist);
2912 Scanner myReader = new Scanner(myObj);
2913
2914 // split string to 6 set
2915
2916 // split string to 6 set
2917
2918 // your directory
2919 File f = new File("./src/Note");
2920 File[] matchingFiles = f.listFiles(new FilenameFilter() {
2921 public boolean accept(File dir, String name) {
2922 return name.endsWith("txt");
2923 }
2924 });
2925
2926 boolean noNote = true;
2927 for(int o=0; o<matchingFiles.length; o++)
2928 {
2929 try {
2930 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(5);
2931 String yourpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
2932
2933
2934 // //System.out.println(opponentpokemon );
2935 if(this.opponentpokemonStage.equals(opponentpokemon)&&this.yourpokemonStage.equals(yourpokemon))
2936 {
2937 String notename = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(0);
2938 String adviceText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
2939 String predictText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(6);
2940 this.noteAdvice = adviceText;
2941 this.notePredict = predictText;
2942 arr.add(matchingFiles[o].toString());
2943
2944 }
2945
2946 } catch (IOException ex) {
2947 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2948 }
2949 }
2950 if(notePredict==null){
2951 for(int o=0; o<matchingFiles.length; o++)
2952 {
2953 try {
2954 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(5);
2955
2956
2957 // //System.out.println(opponentpokemon );
2958 if(this.opponentpokemonStage.equalsIgnoreCase(opponentpokemon))
2959 {
2960 String notename = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(0);
2961 String adviceText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(2);
2962 String predictText = Files.readAllLines(Paths.get(matchingFiles[o].toString())).get(6);
2963 this.noteAdvice = adviceText;
2964 this.notePredict = predictText;
2965 arr.add(matchingFiles[o].toString());
2966 noNote = false;
2967 }
2968
2969 } catch (IOException ex) {
2970 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2971 }
2972 }
2973 }
2974 if(noNote){
2975 //System.out.println("WRYYYYYYYYYYYYYYYYYYY");
2976
2977 this.noteAdvice = "";
2978 this.notePredict = "";
2979
2980 }
2981 }catch (FileNotFoundException e) {
2982 // errorTF.setText("Can't find team name!");
2983 JOptionPane.showMessageDialog(null, "Can't find note name!");
2984 // //System.out.println("An error occurred.");
2985 e.printStackTrace();
2986 }catch (IOException ex) {
2987 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
2988 }
2989 }
2990 else if(words[i].toString().equals("lost"))
2991 {
2992
2993 String name = words[i-1].substring(1);
2994 //System.out.println("USED attack opponent" + words[i- 1]);
2995 if(name.equals(this.yourpokemonStage))
2996 {
2997 try {
2998 Object item = yourTeamComboBox.getSelectedItem();
2999 String search = (String) item;
3000
3001 String pokemonName2 = Files.readAllLines(Paths.get(search)).get(0);
3002 //System.out.println(pokemonName2);
3003
3004 // split string to 6 set
3005 String[] arrOfStr = pokemonName2.split(", ", 6);
3006 String pokemon1 = arrOfStr[0].substring(1);
3007 String pokemon2 = arrOfStr[1];
3008 String pokemon3 = arrOfStr[2];
3009 String pokemon4 = arrOfStr[3];
3010 String pokemon5 = arrOfStr[4];
3011 String pokemon6 = arrOfStr[5].substring(0, arrOfStr[5].length() - 1 );
3012 // split string to 6 set
3013 if(this.yourpokemonStage.equals(pokemon1))
3014 {
3015 String hpLost = words[i+1];
3016 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3017 this.health1 = (this.health1 - Integer.parseInt(Lost));
3018 //System.out.println(this.health1);
3019 }
3020 else if(this.yourpokemonStage.equals(pokemon2))
3021 {
3022 String hpLost = words[i+1];
3023 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3024 this.health2 = (this.health2 - Integer.parseInt(Lost));
3025 //System.out.println(this.health2);
3026 }
3027 else if(this.yourpokemonStage.equals(pokemon3))
3028 {
3029 String hpLost = words[i+1];
3030 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3031 this.health3 = (this.health3 - Integer.parseInt(Lost));
3032 //System.out.println(this.health3);
3033 }
3034 else if(this.yourpokemonStage.equals(pokemon4))
3035 {
3036 String hpLost = words[i+1];
3037 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3038 this.health4 = (this.health4 - Integer.parseInt(Lost));
3039 //System.out.println(this.health4);
3040 }
3041 else if(this.yourpokemonStage.equals(pokemon5))
3042 {
3043 String hpLost = words[i+1];
3044 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3045 this.health5 = (this.health5 - Integer.parseInt(Lost));
3046 //System.out.println(this.health5);
3047 }
3048 else if(this.yourpokemonStage.equals(pokemon6))
3049 {
3050 String hpLost = words[i+1];
3051 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3052 this.health6 = (this.health6 - Integer.parseInt(Lost));
3053 //System.out.println(this.health6);
3054 }
3055 } catch (IOException ex) {
3056 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
3057 }
3058
3059 }
3060 else if(words[i-1].equals(this.opponentpokemonStage))
3061 {
3062 if(this.pokemon1.equals(this.opponentpokemonStage))
3063 {
3064 String hpLost = words[i+1];
3065 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3066 this.health7 = (this.health7 - Integer.parseInt(Lost));
3067 //System.out.println(this.health7);
3068 }
3069 else if(this.pokemon1.equals(this.opponentpokemonStage))
3070 {
3071 String hpLost = words[i+1];
3072 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3073 this.health8 = (this.health8 - Integer.parseInt(Lost));
3074 //System.out.println(this.health8);
3075 }
3076 else if(this.pokemon2.equals(this.opponentpokemonStage))
3077 {
3078 String hpLost = words[i+1];
3079 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3080 this.health9 = (this.health9 - Integer.parseInt(Lost));
3081 //System.out.println(this.health9);
3082 }
3083 else if(this.pokemon3.equals(this.opponentpokemonStage))
3084 {
3085 String hpLost = words[i+1];
3086 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3087 this.health10 = (this.health10 - Integer.parseInt(Lost));
3088 //System.out.println(this.health10);
3089 }
3090 else if(this.pokemon4.equals(this.opponentpokemonStage))
3091 {
3092 String hpLost = words[i+1];
3093 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3094 this.health11 = (this.health11 - Integer.parseInt(Lost));
3095 //System.out.println(this.health11);
3096 }
3097 else if(this.pokemon5.equals(this.opponentpokemonStage))
3098 {
3099 String hpLost = words[i+1];
3100 String Lost = hpLost.substring(0, hpLost.length() - 1 );
3101 this.health12 = (this.health12 - Integer.parseInt(Lost));
3102 //System.out.println(this.health12);
3103 }
3104 }
3105
3106 }
3107 else if(words[i].toString().equals("Go!"))
3108 {
3109
3110 //System.out.println( "Go" + words[i+1]);
3111 String your = words[i+1];
3112 this.yourpokemonStage = your.substring(0, your.length() - 1 );
3113
3114 }
3115
3116 }
3117 }
3118 }
3119 }
3120
3121 }
3122
3123
3124
3125 if(this.yourpokemonStage != null)
3126 {
3127
3128 ArrayList<String> arraymultiplierX4 = new ArrayList<String>();
3129 ArrayList<String> arraymultiplierX2 = new ArrayList<String>();
3130 ArrayList<String> arraymultiplierX1 = new ArrayList<String>();
3131 ArrayList<String> arraymultiplierX0 = new ArrayList<String>();
3132 ArrayList<String> arraymultiplierX05 = new ArrayList<String>();
3133 ArrayList<String> arraymultiplierX025 = new ArrayList<String>();
3134
3135 try {
3136 String pokemonType = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(4);
3137 String[] arrOfStr = pokemonType.split(",", 2);
3138 int countType = 1;
3139 int type = arrOfStr.length;
3140 // //System.out.println(arrOfStr.length);
3141 if(countType == type)
3142 {
3143
3144 String typeName1 = arrOfStr[0];
3145 String type1 = typeName1.substring(2, typeName1.length() - 2 );
3146
3147 arraymultiplierX4 = Calculator.typeCalc4(type1, null);
3148 arraymultiplierX2 = Calculator.typeCalc2(type1, null);
3149 arraymultiplierX1 = Calculator.typeCalc1(type1, null);
3150 arraymultiplierX0 = Calculator.typeCalc0(type1, null);
3151 arraymultiplierX05 = Calculator.typeCalcHalf(type1, null);
3152 arraymultiplierX025 = Calculator.typeCalcFourth(type1, null);
3153
3154 String multiplierX4 = arraymultiplierX4.toString().substring(1, arraymultiplierX4.toString().length() - 1 );
3155 String multiplierX2 = arraymultiplierX2.toString().substring(1, arraymultiplierX2.toString().length() - 1 );
3156 String multiplierX1 = arraymultiplierX1.toString().substring(1, arraymultiplierX1.toString().length() - 1 );
3157 String multiplierX0 = arraymultiplierX0.toString().substring(1, arraymultiplierX0.toString().length() - 1 );
3158 String multiplierX05 = arraymultiplierX05.toString().substring(1, arraymultiplierX05.toString().length() - 1 );
3159 String multiplierX025 = arraymultiplierX025.toString().substring(1, arraymultiplierX025.toString().length() - 1 );
3160
3161 yourWeaknessTable.setText("X4 : " + multiplierX4 + "\n" +
3162 "X2 : " + multiplierX2 + "\n" +
3163 "X1 : " + multiplierX1 + "\n" +
3164 "X0 : " + multiplierX0 + "\n" +
3165 "X0.5 : " + multiplierX05 + "\n" +
3166 "X0.25 : " + multiplierX025 + "\n" );
3167
3168 ArrayCounterType.add(type1);
3169 ArrayCounterType.add(null);
3170 }
3171 else
3172 {
3173
3174 String typeName1 = arrOfStr[0];
3175 String typeName2 = arrOfStr[1];
3176 String type1 = typeName1.substring(2, typeName1.length() - 1 );
3177 String type2 = typeName2.substring(1, typeName2.length() - 2 );
3178
3179
3180 arraymultiplierX4 = Calculator.typeCalc4(type1, type2);
3181 arraymultiplierX2 = Calculator.typeCalc2(type1, type2);
3182 arraymultiplierX1 = Calculator.typeCalc1(type1, type2);
3183 arraymultiplierX0 = Calculator.typeCalc0(type1, type2);
3184 arraymultiplierX05 = Calculator.typeCalcHalf(type1, type2);
3185 arraymultiplierX025 = Calculator.typeCalcFourth(type1, type2);
3186
3187 String multiplierX4 = arraymultiplierX4.toString().substring(1, arraymultiplierX4.toString().length() - 1 );
3188 String multiplierX2 = arraymultiplierX2.toString().substring(1, arraymultiplierX2.toString().length() - 1 );
3189 String multiplierX1 = arraymultiplierX1.toString().substring(1, arraymultiplierX1.toString().length() - 1 );
3190 String multiplierX0 = arraymultiplierX0.toString().substring(1, arraymultiplierX0.toString().length() - 1 );
3191 String multiplierX05 = arraymultiplierX05.toString().substring(1, arraymultiplierX05.toString().length() - 1 );
3192 String multiplierX025 = arraymultiplierX025.toString().substring(1, arraymultiplierX025.toString().length() - 1 );
3193
3194 yourWeaknessTable.setText("X4 : " + multiplierX4 + "\n" +
3195 "X2 : " + multiplierX2 + "\n" +
3196 "X1 : " + multiplierX1 + "\n" +
3197 "X0 : " + multiplierX0 + "\n" +
3198 "X0.5 : " + multiplierX05 + "\n" +
3199 "X0.25 : " + multiplierX025 + "\n" );
3200 ArrayCounterType.add(type1);
3201 ArrayCounterType.add(type2);
3202
3203 }
3204 } catch (IOException ex) {
3205 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
3206 }
3207 }
3208
3209 if(this.opponentpokemonStage != null)
3210 {
3211 JSONParser jsonParser = new JSONParser();
3212 try (FileReader reader = new FileReader("pokemon.json"))
3213 {
3214 //Read JSON file
3215 Object obj = jsonParser.parse(reader);
3216
3217 JSONArray pokemon = (JSONArray) obj;
3218
3219 pokemon.forEach( item -> {
3220 JSONObject pokemonName = (JSONObject) item;
3221 String name = (String) pokemonName.get("name");
3222
3223 if(this.opponentpokemonStage.equals(name))
3224 {
3225 ArrayList<String> arraymultiplierX4 = new ArrayList<String>();
3226 ArrayList<String> arraymultiplierX2 = new ArrayList<String>();
3227 ArrayList<String> arraymultiplierX1 = new ArrayList<String>();
3228 ArrayList<String> arraymultiplierX0 = new ArrayList<String>();
3229 ArrayList<String> arraymultiplierX05 = new ArrayList<String>();
3230 ArrayList<String> arraymultiplierX025 = new ArrayList<String>();
3231
3232
3233 String[] arrOfStr = pokemonName.get("types").toString().split(",", 2);
3234 this.opponentState = pokemonName.get("base_stats").toString();
3235
3236 int countType = 1;
3237 int type = arrOfStr.length;
3238 if(countType == type)
3239 {
3240
3241 String typeName1 = arrOfStr[0];
3242 String type1 = typeName1.substring(2, typeName1.length() - 2 );
3243
3244 arraymultiplierX4 = Calculator.typeCalc4(type1, null);
3245 arraymultiplierX2 = Calculator.typeCalc2(type1, null);
3246 arraymultiplierX1 = Calculator.typeCalc1(type1, null);
3247 arraymultiplierX0 = Calculator.typeCalc0(type1, null);
3248 arraymultiplierX05 = Calculator.typeCalcHalf(type1, null);
3249 arraymultiplierX025 = Calculator.typeCalcFourth(type1, null);
3250
3251 String multiplierX4 = arraymultiplierX4.toString().substring(1, arraymultiplierX4.toString().length() - 1 );
3252 String multiplierX2 = arraymultiplierX2.toString().substring(1, arraymultiplierX2.toString().length() - 1 );
3253 String multiplierX1 = arraymultiplierX1.toString().substring(1, arraymultiplierX1.toString().length() - 1 );
3254 String multiplierX0 = arraymultiplierX0.toString().substring(1, arraymultiplierX0.toString().length() - 1 );
3255 String multiplierX05 = arraymultiplierX05.toString().substring(1, arraymultiplierX05.toString().length() - 1 );
3256 String multiplierX025 = arraymultiplierX025.toString().substring(1, arraymultiplierX025.toString().length() - 1 );
3257
3258 opponentWeaknessTable.setText("X4 : " + multiplierX4 + "\n" +
3259 "X2 : " + multiplierX2 + "\n" +
3260 "X1 : " + multiplierX1 + "\n" +
3261 "X0 : " + multiplierX0 + "\n" +
3262 "X0.5 : " + multiplierX05 + "\n" +
3263 "X0.25 : " + multiplierX025 + "\n" );
3264 ArrayCounterType.add(type1);
3265 ArrayCounterType.add(null);
3266
3267 }
3268 else
3269 {
3270 String typeName1 = arrOfStr[0];
3271 String typeName2 = arrOfStr[1];
3272 String type1 = typeName1.substring(2, typeName1.length() - 1 );
3273 String type2 = typeName2.substring(1, typeName2.length() - 2 );
3274
3275
3276 arraymultiplierX4 = Calculator.typeCalc4(type1, type2);
3277 arraymultiplierX2 = Calculator.typeCalc2(type1, type2);
3278 arraymultiplierX1 = Calculator.typeCalc1(type1, type2);
3279 arraymultiplierX0 = Calculator.typeCalc0(type1, type2);
3280 arraymultiplierX05 = Calculator.typeCalcHalf(type1, type2);
3281 arraymultiplierX025 = Calculator.typeCalcFourth(type1, type2);
3282
3283 String multiplierX4 = arraymultiplierX4.toString().substring(1, arraymultiplierX4.toString().length() - 1 );
3284 String multiplierX2 = arraymultiplierX2.toString().substring(1, arraymultiplierX2.toString().length() - 1 );
3285 String multiplierX1 = arraymultiplierX1.toString().substring(1, arraymultiplierX1.toString().length() - 1 );
3286 String multiplierX0 = arraymultiplierX0.toString().substring(1, arraymultiplierX0.toString().length() - 1 );
3287 String multiplierX05 = arraymultiplierX05.toString().substring(1, arraymultiplierX05.toString().length() - 1 );
3288 String multiplierX025 = arraymultiplierX025.toString().substring(1, arraymultiplierX025.toString().length() - 1 );
3289
3290 opponentWeaknessTable.setText("X4 : " + multiplierX4 + "\n" +
3291 "X2 : " + multiplierX2 + "\n" +
3292 "X1 : " + multiplierX1 + "\n" +
3293 "X0 : " + multiplierX0 + "\n" +
3294 "X0.5 : " + multiplierX05 + "\n" +
3295 "X0.25 : " + multiplierX025 + "\n" );
3296
3297 ArrayCounterType.add(type1);
3298 ArrayCounterType.add(type2);
3299 }
3300 }
3301 });
3302
3303 } catch (FileNotFoundException e) {
3304 e.printStackTrace();
3305 } catch (IOException e) {
3306 e.printStackTrace();
3307 } catch (ParseException e) {
3308 e.printStackTrace();
3309 }
3310 }
3311
3312
3313 inputTF.setText("");
3314 if(this.start_ = true)
3315 {
3316 boolean lost = Calculator.typeCalcAdvantage(ArrayCounterType.get(0), ArrayCounterType.get(1), ArrayCounterType.get(2), ArrayCounterType.get(3));
3317
3318 if(lost == true)
3319 {
3320 //System.out.println("true");
3321 try {
3322 String pokemonState = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(5);
3323 // split string to 6 set
3324 String[] arrayState = pokemonState.split(",", 6);
3325 String HP = arrayState[0].substring(1);
3326 String ATK = arrayState[1];
3327 String SPA = arrayState[2];
3328 String DEF = arrayState[3];
3329 String SPD = arrayState[4];
3330 String SPE = arrayState[5].substring(0, arrayState[5].length() - 1 );
3331 // split string to 6 set
3332
3333 // split string to 6 set
3334 String[] arrayState2 = this.opponentState.split(",", 6);
3335 String opponentHP = arrayState2[0].substring(1);
3336 String opponentATK = arrayState2[1];
3337 String opponentSPA = arrayState2[2];
3338 String opponentDEF = arrayState2[3];
3339 String opponentSPD = arrayState2[4];
3340 String opponentSPE = arrayState2[5].substring(0, arrayState2[5].length() - 1 );
3341 // split string to 6 set
3342
3343 if(Integer.parseInt(SPE) > Integer.parseInt(opponentSPE))
3344 {
3345 if(Integer.parseInt(ATK) >= 100)
3346 {
3347 if(Integer.parseInt(opponentDEF) > 80 )
3348 {
3349 if(this.pokemon1.equals(this.opponentpokemonStage))
3350 {
3351 if(this.health7 < 50)
3352 {
3353 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3354 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3355 }
3356 else
3357 {
3358 //System.out.println("7");
3359 ArrayList<String> arraylistMove = new ArrayList<String>();
3360 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3361 // split string to 6 set
3362 String[] arrayMove = pokemonMove.split(", ", 4);
3363 arraylistMove.add(arrayMove[0].substring(1));
3364 arraylistMove.add(arrayMove[1]);
3365 arraylistMove.add(arrayMove[2]);
3366 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3367 // split string to 6 set
3368
3369 //System.out.println("For Loop check have move U-turn ?");
3370 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3371 //System.out.println(arraylistMove.get(counter));
3372 if(arraylistMove.get(counter).equals("U-turn"))
3373 {
3374 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3375 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3376 }
3377 else
3378 {
3379 if(arraylistMove.get(counter).equals("Volt Switch"))
3380 {
3381 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3382 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3383 }
3384 else
3385 {
3386 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3387 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3388 }
3389 }
3390 }
3391 }
3392 }
3393 else if(this.pokemon2.equals(this.opponentpokemonStage))
3394 {
3395 if(this.health8 < 50)
3396 {
3397 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3398 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3399 }
3400 else
3401 {
3402 ArrayList<String> arraylistMove = new ArrayList<String>();
3403 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3404 // split string to 6 set
3405 String[] arrayMove = pokemonMove.split(", ", 4);
3406 arraylistMove.add(arrayMove[0].substring(1));
3407 arraylistMove.add(arrayMove[1]);
3408 arraylistMove.add(arrayMove[2]);
3409 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3410 // split string to 6 set
3411
3412 //System.out.println("For Loop check have move U-turn ?");
3413 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3414 //System.out.println(arraylistMove.get(counter));
3415 if(arraylistMove.get(counter).equals("U-turn"))
3416 {
3417 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3418 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3419 }
3420 else
3421 {
3422 if(arraylistMove.get(counter).equals("Volt Switch"))
3423 {
3424 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3425 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3426 }
3427 else
3428 {
3429 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3430 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3431 }
3432 }
3433 }
3434 }
3435 }
3436 else if(this.pokemon3.equals(this.opponentpokemonStage))
3437 {
3438 if(this.health9 < 50)
3439 {
3440 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3441 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3442 }
3443 else
3444 {
3445 ArrayList<String> arraylistMove = new ArrayList<String>();
3446 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3447 // split string to 6 set
3448 String[] arrayMove = pokemonMove.split(", ", 4);
3449 arraylistMove.add(arrayMove[0].substring(1));
3450 arraylistMove.add(arrayMove[1]);
3451 arraylistMove.add(arrayMove[2]);
3452 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3453 // split string to 6 set
3454
3455 //System.out.println("For Loop check have move U-turn ?");
3456 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3457 //System.out.println(arraylistMove.get(counter));
3458 if(arraylistMove.get(counter).equals("U-turn"))
3459 {
3460 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3461 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3462 }
3463 else
3464 {
3465 if(arraylistMove.get(counter).equals("Volt Switch"))
3466 {
3467 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3468 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3469 }
3470 else
3471 {
3472 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" +"Switch to a pokemon will type advantage");
3473 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3474 }
3475 }
3476 }
3477 }
3478 }
3479 else if(this.pokemon4.equals(this.opponentpokemonStage))
3480 {
3481 if(this.health10 < 50)
3482 {
3483 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3484 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3485 }
3486 else
3487 {
3488 ArrayList<String> arraylistMove = new ArrayList<String>();
3489 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3490 // split string to 6 set
3491 String[] arrayMove = pokemonMove.split(", ", 4);
3492 arraylistMove.add(arrayMove[0].substring(1));
3493 arraylistMove.add(arrayMove[1]);
3494 arraylistMove.add(arrayMove[2]);
3495 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3496 // split string to 6 set
3497
3498 //System.out.println("For Loop check have move U-turn ?");
3499 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3500 //System.out.println(arraylistMove.get(counter));
3501 if(arraylistMove.get(counter).equals("U-turn"))
3502 {
3503 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3504 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3505 }
3506 else
3507 {
3508 if(arraylistMove.get(counter).equals("Volt Switch"))
3509 {
3510 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3511 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3512 }
3513 else
3514 {
3515 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3516 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3517 }
3518 }
3519 }
3520 }
3521 }
3522 else if(this.pokemon5.equals(this.opponentpokemonStage))
3523 {
3524 if(this.health11 < 50)
3525 {
3526 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3527 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3528 }
3529 else
3530 {
3531 ArrayList<String> arraylistMove = new ArrayList<String>();
3532 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3533 // split string to 6 set
3534 String[] arrayMove = pokemonMove.split(", ", 4);
3535 arraylistMove.add(arrayMove[0].substring(1));
3536 arraylistMove.add(arrayMove[1]);
3537 arraylistMove.add(arrayMove[2]);
3538 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3539 // split string to 6 set
3540
3541 //System.out.println("For Loop check have move U-turn ?");
3542 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3543 //System.out.println(arraylistMove.get(counter));
3544 if(arraylistMove.get(counter).equals("U-turn"))
3545 {
3546 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3547 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3548 }
3549 else
3550 {
3551 if(arraylistMove.get(counter).equals("Volt Switch"))
3552 {
3553 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3554 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3555 }
3556 else
3557 {
3558 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3559 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3560 }
3561 }
3562 }
3563 }
3564 }
3565 else if(this.pokemon6.equals(this.opponentpokemonStage))
3566 {
3567 if(this.health12 < 50)
3568 {
3569 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3570 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3571 }
3572 else
3573 {
3574 ArrayList<String> arraylistMove = new ArrayList<String>();
3575 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3576 // split string to 6 set
3577 String[] arrayMove = pokemonMove.split(", ", 4);
3578 arraylistMove.add(arrayMove[0].substring(1));
3579 arraylistMove.add(arrayMove[1]);
3580 arraylistMove.add(arrayMove[2]);
3581 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3582 // split string to 6 set
3583
3584 //System.out.println("For Loop check have move U-turn ?");
3585 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3586 //System.out.println(arraylistMove.get(counter));
3587 if(arraylistMove.get(counter).equals("U-turn"))
3588 {
3589 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3590 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3591 }
3592 else
3593 {
3594 if(arraylistMove.get(counter).equals("Volt Switch"))
3595 {
3596 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3597 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3598 }
3599 else
3600 {
3601 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3602 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3603 }
3604 }
3605 }
3606 }
3607 }
3608 }
3609 else
3610 {
3611 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3612 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3613 }
3614 }
3615 else
3616 {
3617 if(Integer.parseInt(opponentSPD) > 80 )
3618 {
3619 if(this.pokemon1.equals(this.opponentpokemonStage))
3620 {
3621 if(this.health7 < 50)
3622 {
3623 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3624 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3625 }
3626 else
3627 {
3628 //System.out.println("7");
3629 ArrayList<String> arraylistMove = new ArrayList<String>();
3630 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3631 // split string to 6 set
3632 String[] arrayMove = pokemonMove.split(", ", 4);
3633 arraylistMove.add(arrayMove[0].substring(1));
3634 arraylistMove.add(arrayMove[1]);
3635 arraylistMove.add(arrayMove[2]);
3636 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3637 // split string to 6 set
3638
3639 //System.out.println("For Loop check have move U-turn ?");
3640 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3641 //System.out.println(arraylistMove.get(counter));
3642 if(arraylistMove.get(counter).equals("U-turn"))
3643 {
3644 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3645 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3646 }
3647 else
3648 {
3649 if(arraylistMove.get(counter).equals("Volt Switch"))
3650 {
3651 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3652 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3653 }
3654 else
3655 {
3656 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3657 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3658 }
3659 }
3660 }
3661 }
3662 }
3663 else if(this.pokemon2.equals(this.opponentpokemonStage))
3664 {
3665 if(this.health8 < 50)
3666 {
3667 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3668 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3669 }
3670 else
3671 {
3672 ArrayList<String> arraylistMove = new ArrayList<String>();
3673 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3674 // split string to 6 set
3675 String[] arrayMove = pokemonMove.split(", ", 4);
3676 arraylistMove.add(arrayMove[0].substring(1));
3677 arraylistMove.add(arrayMove[1]);
3678 arraylistMove.add(arrayMove[2]);
3679 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3680 // split string to 6 set
3681
3682 //System.out.println("For Loop check have move U-turn ?");
3683 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3684 //System.out.println(arraylistMove.get(counter));
3685 if(arraylistMove.get(counter).equals("U-turn"))
3686 {
3687 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3688 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3689 }
3690 else
3691 {
3692 if(arraylistMove.get(counter).equals("Volt Switch"))
3693 {
3694 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3695 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3696 }
3697 else
3698 {
3699 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3700 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3701 }
3702 }
3703 }
3704 }
3705 }
3706 else if(this.pokemon3.equals(this.opponentpokemonStage))
3707 {
3708 if(this.health9 < 50)
3709 {
3710 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3711 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3712 }
3713 else
3714 {
3715 ArrayList<String> arraylistMove = new ArrayList<String>();
3716 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3717 // split string to 6 set
3718 String[] arrayMove = pokemonMove.split(", ", 4);
3719 arraylistMove.add(arrayMove[0].substring(1));
3720 arraylistMove.add(arrayMove[1]);
3721 arraylistMove.add(arrayMove[2]);
3722 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3723 // split string to 6 set
3724
3725 //System.out.println("For Loop check have move U-turn ?");
3726 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3727 //System.out.println(arraylistMove.get(counter));
3728 if(arraylistMove.get(counter).equals("U-turn"))
3729 {
3730 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3731 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3732 }
3733 else
3734 {
3735 if(arraylistMove.get(counter).equals("Volt Switch"))
3736 {
3737 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3738 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3739 }
3740 else
3741 {
3742 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3743 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3744 }
3745 }
3746 }
3747 }
3748 }
3749 else if(this.pokemon4.equals(this.opponentpokemonStage))
3750 {
3751 if(this.health10 < 50)
3752 {
3753 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3754 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3755 }
3756 else
3757 {
3758 ArrayList<String> arraylistMove = new ArrayList<String>();
3759 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3760 // split string to 6 set
3761 String[] arrayMove = pokemonMove.split(", ", 4);
3762 arraylistMove.add(arrayMove[0].substring(1));
3763 arraylistMove.add(arrayMove[1]);
3764 arraylistMove.add(arrayMove[2]);
3765 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3766 // split string to 6 set
3767
3768 //System.out.println("For Loop check have move U-turn ?");
3769 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3770 //System.out.println(arraylistMove.get(counter));
3771 if(arraylistMove.get(counter).equals("U-turn"))
3772 {
3773 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3774 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3775 }
3776 else
3777 {
3778 if(arraylistMove.get(counter).equals("Volt Switch"))
3779 {
3780 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3781 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3782 }
3783 else
3784 {
3785 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3786 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3787 }
3788 }
3789 }
3790 }
3791 }
3792 else if(this.pokemon5.equals(this.opponentpokemonStage))
3793 {
3794 if(this.health11 < 50)
3795 {
3796 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3797 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3798 }
3799 else
3800 {
3801 ArrayList<String> arraylistMove = new ArrayList<String>();
3802 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3803 // split string to 6 set
3804 String[] arrayMove = pokemonMove.split(", ", 4);
3805 arraylistMove.add(arrayMove[0].substring(1));
3806 arraylistMove.add(arrayMove[1]);
3807 arraylistMove.add(arrayMove[2]);
3808 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3809 // split string to 6 set
3810
3811 //System.out.println("For Loop check have move U-turn ?");
3812 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3813 //System.out.println(arraylistMove.get(counter));
3814 if(arraylistMove.get(counter).equals("U-turn"))
3815 {
3816 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3817 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3818 }
3819 else
3820 {
3821 if(arraylistMove.get(counter).equals("Volt Switch"))
3822 {
3823 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3824 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3825 }
3826 else
3827 {
3828 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3829 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3830 }
3831 }
3832 }
3833 }
3834 }
3835 else if(this.pokemon6.equals(this.opponentpokemonStage))
3836 {
3837 if(this.health12 < 50)
3838 {
3839 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3840 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3841 }
3842 else
3843 {
3844 ArrayList<String> arraylistMove = new ArrayList<String>();
3845 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3846 // split string to 6 set
3847 String[] arrayMove = pokemonMove.split(", ", 4);
3848 arraylistMove.add(arrayMove[0].substring(1));
3849 arraylistMove.add(arrayMove[1]);
3850 arraylistMove.add(arrayMove[2]);
3851 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3852 // split string to 6 set
3853
3854 //System.out.println("For Loop check have move U-turn ?");
3855 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3856 //System.out.println(arraylistMove.get(counter));
3857 if(arraylistMove.get(counter).equals("U-turn"))
3858 {
3859 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3860 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3861 }
3862 else
3863 {
3864 if(arraylistMove.get(counter).equals("Volt Switch"))
3865 {
3866 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3867 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3868 }
3869 else
3870 {
3871 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3872 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3873 }
3874 }
3875 }
3876 }
3877 }
3878 }
3879 else
3880 {
3881 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Attack the opponent!");
3882 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably switch but there is a chance that they will stay in They will more likely switch though.");
3883 }
3884 }
3885 // JSONParser jsonParser = new JSONParser();
3886 // try (FileReader reader = new FileReader("moves.json"))
3887 // {
3888 // //Read JSON file
3889 // Object obj = jsonParser.parse(reader);
3890 //
3891 // JSONArray pokemonMove = (JSONArray) obj;
3892 //
3893 // pokemonMove.forEach( item -> {
3894 // JSONObject pokemonName = (JSONObject) item;
3895 // String name = (String) pokemonName.get("ename");
3896 // //System.out.println(name);
3897 //
3898 // });
3899 //
3900 // } catch (FileNotFoundException e) {
3901 // e.printStackTrace();
3902 // } catch (IOException e) {
3903 // e.printStackTrace();
3904 // } catch (ParseException e) {
3905 // e.printStackTrace();
3906 // }
3907
3908 }
3909 else
3910 {
3911 if(importantPokemonTF.getText().equals(""))
3912 {
3913
3914 try {
3915 Object item = yourTeamComboBox.getSelectedItem();
3916 String search = (String) item;
3917
3918 String pokemonName2 = Files.readAllLines(Paths.get(search)).get(0);
3919 //System.out.println(pokemonName2);
3920
3921 // split string to 6 set
3922 String[] arrOfStr = pokemonName2.split(", ", 6);
3923 String pokemon1 = arrOfStr[0].substring(1);
3924 String pokemon2 = arrOfStr[1];
3925 String pokemon3 = arrOfStr[2];
3926 String pokemon4 = arrOfStr[3];
3927 String pokemon5 = arrOfStr[4];
3928 String pokemon6 = arrOfStr[5].substring(0, arrOfStr[5].length() - 1 );
3929 // split string to 6 set
3930 if(this.yourpokemonStage.equals(pokemon1))
3931 {
3932 if(this.health1 > 80)
3933 {
3934 if(Integer.parseInt(opponentATK) > Integer.parseInt(opponentSPA))
3935 {
3936 if(Integer.parseInt(DEF) >= 100)
3937 {
3938 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
3939 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
3940 }
3941 else
3942 {
3943 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
3944 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
3945 }
3946 }
3947 else
3948 {
3949 if(Integer.parseInt(SPD) >= 100)
3950 {
3951 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
3952 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
3953 }
3954 else
3955 {
3956 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
3957 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
3958 }
3959 }
3960 }
3961 else
3962 {
3963 ArrayList<String> arraylistMove = new ArrayList<String>();
3964 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
3965 // split string to 6 set
3966 String[] arrayMove = pokemonMove.split(", ", 4);
3967 arraylistMove.add(arrayMove[0].substring(1));
3968 arraylistMove.add(arrayMove[1]);
3969 arraylistMove.add(arrayMove[2]);
3970 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
3971 // split string to 6 set
3972
3973 //System.out.println("For Loop check have move U-turn ?");
3974 for (int counter = 0; counter < arraylistMove.size(); counter++) {
3975 //System.out.println(arraylistMove.get(counter));
3976 if(arraylistMove.get(counter).equals("U-turn"))
3977 {
3978 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
3979 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3980 }
3981 else
3982 {
3983 if(arraylistMove.get(counter).equals("Volt Switch"))
3984 {
3985 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
3986 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3987 }
3988 else
3989 {
3990 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
3991 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
3992 }
3993 }
3994 }
3995 }
3996
3997 }
3998 else if(this.yourpokemonStage.equals(pokemon2))
3999 {
4000 if(this.health2 > 80)
4001 {
4002 if(Integer.parseInt(opponentATK) > Integer.parseInt(opponentSPA))
4003 {
4004 if(Integer.parseInt(DEF) >= 100)
4005 {
4006 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4007 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4008 }
4009 else
4010 {
4011 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4012 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4013 }
4014 }
4015 else
4016 {
4017 if(Integer.parseInt(SPD) >= 100)
4018 {
4019 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4020 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4021 }
4022 else
4023 {
4024 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4025 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4026 }
4027 }
4028 }
4029 else
4030 {
4031 ArrayList<String> arraylistMove = new ArrayList<String>();
4032 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
4033 // split string to 6 set
4034 String[] arrayMove = pokemonMove.split(", ", 4);
4035 arraylistMove.add(arrayMove[0].substring(1));
4036 arraylistMove.add(arrayMove[1]);
4037 arraylistMove.add(arrayMove[2]);
4038 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
4039 // split string to 6 set
4040
4041 //System.out.println("For Loop check have move U-turn ?");
4042 for (int counter = 0; counter < arraylistMove.size(); counter++) {
4043 //System.out.println(arraylistMove.get(counter));
4044 if(arraylistMove.get(counter).equals("U-turn"))
4045 {
4046 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
4047 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4048 }
4049 else
4050 {
4051 if(arraylistMove.get(counter).equals("Volt Switch"))
4052 {
4053 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
4054 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4055 }
4056 else
4057 {
4058 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
4059 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4060 }
4061 }
4062 }
4063 }
4064 }
4065 else if(this.yourpokemonStage.equals(pokemon3))
4066 {
4067 if(this.health3 > 80)
4068 {
4069 if(Integer.parseInt(opponentATK) > Integer.parseInt(opponentSPA))
4070 {
4071 if(Integer.parseInt(DEF) >= 100)
4072 {
4073 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4074 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4075 }
4076 else
4077 {
4078 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4079 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4080 }
4081 }
4082 else
4083 {
4084 if(Integer.parseInt(SPD) >= 100)
4085 {
4086 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4087 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4088 }
4089 else
4090 {
4091 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4092 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4093 }
4094 }
4095 }
4096 else
4097 {
4098 ArrayList<String> arraylistMove = new ArrayList<String>();
4099 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
4100 // split string to 6 set
4101 String[] arrayMove = pokemonMove.split(", ", 4);
4102 arraylistMove.add(arrayMove[0].substring(1));
4103 arraylistMove.add(arrayMove[1]);
4104 arraylistMove.add(arrayMove[2]);
4105 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
4106 // split string to 6 set
4107
4108 //System.out.println("For Loop check have move U-turn ?");
4109 for (int counter = 0; counter < arraylistMove.size(); counter++) {
4110 //System.out.println(arraylistMove.get(counter));
4111 if(arraylistMove.get(counter).equals("U-turn"))
4112 {
4113 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
4114 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4115 }
4116 else
4117 {
4118 if(arraylistMove.get(counter).equals("Volt Switch"))
4119 {
4120 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
4121 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4122 }
4123 else
4124 {
4125 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
4126 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4127 }
4128 }
4129 }
4130 }
4131 }
4132 else if(this.yourpokemonStage.equals(pokemon4))
4133 {
4134 if(this.health4 > 80)
4135 {
4136 if(Integer.parseInt(opponentATK) > Integer.parseInt(opponentSPA))
4137 {
4138 if(Integer.parseInt(DEF) >= 100)
4139 {
4140 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4141 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4142 }
4143 else
4144 {
4145 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4146 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4147 }
4148 }
4149 else
4150 {
4151 if(Integer.parseInt(SPD) >= 100)
4152 {
4153 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4154 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4155 }
4156 else
4157 {
4158 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4159 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4160 }
4161 }
4162 }
4163 else
4164 {
4165 ArrayList<String> arraylistMove = new ArrayList<String>();
4166 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
4167 // split string to 6 set
4168 String[] arrayMove = pokemonMove.split(", ", 4);
4169 arraylistMove.add(arrayMove[0].substring(1));
4170 arraylistMove.add(arrayMove[1]);
4171 arraylistMove.add(arrayMove[2]);
4172 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
4173 // split string to 6 set
4174
4175 //System.out.println("For Loop check have move U-turn ?");
4176 for (int counter = 0; counter < arraylistMove.size(); counter++) {
4177 //System.out.println(arraylistMove.get(counter));
4178 if(arraylistMove.get(counter).equals("U-turn"))
4179 {
4180 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
4181 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4182 }
4183 else
4184 {
4185 if(arraylistMove.get(counter).equals("Volt Switch"))
4186 {
4187 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
4188 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4189 }
4190 else
4191 {
4192 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" +"Switch to a pokemon will type advantage");
4193 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4194 }
4195 }
4196 }
4197 }
4198 }
4199 else if(this.yourpokemonStage.equals(pokemon5))
4200 {
4201 if(this.health5 > 80)
4202 {
4203 if(Integer.parseInt(opponentATK) > Integer.parseInt(opponentSPA))
4204 {
4205 if(Integer.parseInt(DEF) >= 100)
4206 {
4207 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4208 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4209 }
4210 else
4211 {
4212 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4213 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4214 }
4215 }
4216 else
4217 {
4218 if(Integer.parseInt(SPD) >= 100)
4219 {
4220 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4221 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4222 }
4223 else
4224 {
4225 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4226 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4227 }
4228 }
4229 }
4230 else
4231 {
4232 ArrayList<String> arraylistMove = new ArrayList<String>();
4233 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
4234 // split string to 6 set
4235 String[] arrayMove = pokemonMove.split(", ", 4);
4236 arraylistMove.add(arrayMove[0].substring(1));
4237 arraylistMove.add(arrayMove[1]);
4238 arraylistMove.add(arrayMove[2]);
4239 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
4240 // split string to 6 set
4241
4242 //System.out.println("For Loop check have move U-turn ?");
4243 for (int counter = 0; counter < arraylistMove.size(); counter++) {
4244 //System.out.println(arraylistMove.get(counter));
4245 if(arraylistMove.get(counter).equals("U-turn"))
4246 {
4247 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
4248 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4249 }
4250 else
4251 {
4252 if(arraylistMove.get(counter).equals("Volt Switch"))
4253 {
4254 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
4255 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4256 }
4257 else
4258 {
4259 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
4260 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4261 }
4262 }
4263 }
4264 }
4265 }
4266 else if(this.yourpokemonStage.equals(pokemon6))
4267 {
4268 if(this.health6 > 80)
4269 {
4270 if(Integer.parseInt(opponentATK) > Integer.parseInt(opponentSPA))
4271 {
4272 if(Integer.parseInt(DEF) >= 100)
4273 {
4274 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4275 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4276 }
4277 else
4278 {
4279 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4280 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4281 }
4282 }
4283 else
4284 {
4285 if(Integer.parseInt(SPD) >= 100)
4286 {
4287 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Tank the hit and use a super dffective attack");
4288 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it with a super effective move");
4289 }
4290 else
4291 {
4292 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to something that you're sure it can tank the hit, or just go ahead and sacrifice it");
4293 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4294 }
4295 }
4296 }
4297 else
4298 {
4299 ArrayList<String> arraylistMove = new ArrayList<String>();
4300 String pokemonMove = Files.readAllLines(Paths.get("./src/Filedata/" +this.yourpokemonStage+".txt")).get(1);
4301 // split string to 6 set
4302 String[] arrayMove = pokemonMove.split(", ", 4);
4303 arraylistMove.add(arrayMove[0].substring(1));
4304 arraylistMove.add(arrayMove[1]);
4305 arraylistMove.add(arrayMove[2]);
4306 arraylistMove.add(arrayMove[3].substring(0, arrayMove[3].length() - 1 ));
4307 // split string to 6 set
4308
4309 //System.out.println("For Loop check have move U-turn ?");
4310 for (int counter = 0; counter < arraylistMove.size(); counter++) {
4311 //System.out.println(arraylistMove.get(counter));
4312 if(arraylistMove.get(counter).equals("U-turn"))
4313 {
4314 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use U-turn and switch into a Pokemon that have type effective against the opponent");
4315 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4316 }
4317 else
4318 {
4319 if(arraylistMove.get(counter).equals("Volt Switch"))
4320 {
4321 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use Volt Switch and switch into a Pokemon that have type effective against the opponent");
4322 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4323 }
4324 else
4325 {
4326 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to a pokemon will type advantage");
4327 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "They will probably attack it");
4328 }
4329 }
4330 }
4331 }
4332 }
4333 } catch (IOException ex) {
4334 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
4335 }
4336
4337 }
4338 else
4339 {
4340 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Switch to some unimportant Pokemon");
4341 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent will probably attack it");
4342 }
4343 }
4344 } catch (IOException ex) {
4345 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
4346 }
4347 }
4348 else
4349 {
4350 // multipier not 4 or 2
4351 yourAdvisedNextMoveTF.setText(this.noteAdvice + "\n" + "Use any attack that would deal the most damage to the Pokemon");
4352 yourPredictionNextMoveTF.setText(this.notePredict + "\n" + "The opponent might switch their Pokemon, but it's fine either way");
4353 }
4354
4355 }
4356
4357 }
4358
4359
4360 }
4361
4362 private void searchTextButtonMouseReleased(java.awt.event.MouseEvent evt) {
4363 // TODO add your handling code here:
4364 String search = searchTextTF.getText();
4365 ArrayList<String> arr = new ArrayList<String>();
4366 if(pokemonSearchRB.isSelected()){
4367 //searchname
4368 // your directory
4369 File f = new File("./src/Note");
4370 File[] matchingFiles = f.listFiles(new FilenameFilter() {
4371 public boolean accept(File dir, String name) {
4372 return name.endsWith("txt");
4373 }
4374 });
4375
4376 for (int i=0; i<matchingFiles.length; i++)
4377 {
4378 try {
4379 String yourpokemon = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(1);
4380 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(5);
4381 //System.out.println(yourpokemon );
4382 //System.out.println(opponentpokemon );
4383 if(yourpokemon == null ? search == null : search.equals(yourpokemon) || search.equals(opponentpokemon))
4384 {
4385 String notename = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(0);
4386 //System.out.println("have");
4387 arr.add(matchingFiles[i].toString());
4388 notesFoundComboBox.addItem(notename);
4389 }
4390 else
4391 {
4392 //System.out.println("not");
4393 }
4394
4395 } catch (IOException ex) {
4396 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
4397 }
4398 }
4399 //System.out.println(arr);
4400 // //System.out.println(matchingFiles.length);
4401 // JOptionPane.showMessageDialog(this,"You are Male.");
4402 }
4403 if(noteNameSearchRB.isSelected()){
4404 // JOptionPane.showMessageDialog(this,"You are Female.");
4405
4406 try {
4407 File myObj = new File("./src/Note/"+search+".txt");
4408 Scanner myReader = new Scanner(myObj);
4409 String notename = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(0);
4410 String youpokemon = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(1);
4411 String shoulddo = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(2);
4412
4413 String counter = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(4);
4414 String opponentpokemon = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(5);
4415 String oppenentWill = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(6);
4416
4417 String other = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(8);
4418
4419 noteNameTF.setText(notename);
4420 yourPokemonTF.setText(youpokemon);
4421 adviceTA.setText(shoulddo);
4422
4423 importantCounterTA.setText(counter);
4424 opponentPokemonTF.setText(opponentpokemon);
4425 predictTA.setText(oppenentWill);
4426
4427 possibleThreatTA.setText(other);
4428
4429
4430 }catch (FileNotFoundException e) {
4431 // errorTF.setText("Can't find team name!");
4432 JOptionPane.showMessageDialog(null, "Can't find note name!");
4433 // //System.out.println("An error occurred.");
4434 e.printStackTrace();
4435 }catch (IOException ex) {
4436 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
4437 }
4438
4439 }
4440 }
4441
4442
4443 private void saveNoteButtonMouseReleased(java.awt.event.MouseEvent evt) {
4444 // TODO add your handling code here:
4445 String youPokemon = yourPokemonTF.getText();
4446 String youAdvice = adviceTA.getText();
4447
4448 String youCounter = importantCounterTA.getText();
4449 String noteName = noteNameTF.getText();
4450 String opponentPokemon = opponentPokemonTF.getText();
4451 String opponentAdvice = predictTA.getText();
4452
4453 String posible = possibleThreatTA.getText();
4454 if(!( youAdvice.equals("") || youCounter.equals("") || noteName.equals("") ||
4455 opponentPokemon.equals("") || opponentAdvice.equals("") || posible.equals("")))
4456 {
4457 try {
4458 FileWriter myWriter = new FileWriter("./src/Note/"+ noteName + ".txt");
4459
4460 myWriter.write(noteName);
4461 myWriter.write("\n"+ youPokemon);
4462 myWriter.write("\n"+ youAdvice);
4463 myWriter.write("\n");
4464 myWriter.write("\n"+ youCounter);
4465 myWriter.write("\n"+ opponentPokemon);
4466 myWriter.write("\n"+ opponentAdvice);
4467 myWriter.write("\n");
4468 myWriter.write("\n"+ posible);
4469 myWriter.close();
4470 JOptionPane.showMessageDialog(null, "Create note success!");
4471
4472 } catch (IOException ex) {
4473 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
4474 }
4475 }
4476 else
4477 {
4478 JOptionPane.showMessageDialog(null, "Please Enter all the information!");
4479 }
4480
4481 }
4482
4483 private void searchTextButtonMousePressed(java.awt.event.MouseEvent evt) {
4484 // TODO add your handling code here:
4485 }
4486
4487 private void notesFoundComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
4488 // TODO add your handling code here:
4489 Object item = notesFoundComboBox.getSelectedItem();
4490 String search = (String) item;
4491 try {
4492 File myObj = new File("./src/Note/"+search+".txt");
4493 Scanner myReader = new Scanner(myObj);
4494 String notename = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(0);
4495 String youpokemon = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(1);
4496 String shoulddo = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(2);
4497
4498 String counter = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(4);
4499 String opponentpokemon = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(5);
4500 String oppenentWill = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(6);
4501
4502 String other = Files.readAllLines(Paths.get("./src/Note/" +search+".txt")).get(8);
4503
4504 noteNameTF.setText(notename);
4505 yourPokemonTF.setText(youpokemon);
4506 adviceTA.setText(shoulddo);
4507
4508 importantCounterTA.setText(counter);
4509 opponentPokemonTF.setText(opponentpokemon);
4510 predictTA.setText(oppenentWill);
4511
4512 possibleThreatTA.setText(other);
4513
4514
4515 }catch (FileNotFoundException e) {
4516 // errorTF.setText("Can't find team name!");
4517 JOptionPane.showMessageDialog(null, "Can't find note name!");
4518 // //System.out.println("An error occurred.");
4519 e.printStackTrace();
4520 }catch (IOException ex) {
4521 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
4522 }
4523
4524 }
4525
4526 private void inputTFActionPerformed(java.awt.event.ActionEvent evt) {
4527 // TODO add your handling code here:
4528 }
4529
4530 private void inputTFMouseReleased(java.awt.event.MouseEvent evt) {
4531 // inputTF.paste();
4532 }
4533
4534 private void yourTeamComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
4535 // TODO add your handling code here:
4536 }
4537
4538 private void pokemonStatCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {
4539 // TODO add your handling code here:
4540 statTable1.setModel(new DefaultTableModel(null, new String[]{"Stats Type", "Base Stats"}));
4541 String select = (String) pokemonStatCheckBox.getSelectedItem();
4542 JSONParser jsonParser = new JSONParser();
4543
4544 try (FileReader reader = new FileReader("pokemon.json"))
4545 {
4546 //Read JSON file
4547 Object obj = jsonParser.parse(reader);
4548
4549 JSONArray pokemon = (JSONArray) obj;
4550
4551 pokemon.forEach( item -> {
4552 JSONObject pokemonName = (JSONObject) item;
4553 String name = (String) pokemonName.get("name");
4554
4555 if(select.equals(name))
4556 {
4557 // String all = (String) pokemonName.get("base_stats");
4558
4559 String stats1;
4560 String stats2;
4561 String stats3;
4562 String stats4;
4563 String stats5;
4564 String stats6;
4565
4566 // //System.out.println(all);
4567 // // split string to 6 set
4568 String[] arrOfStr = pokemonName.get("base_stats").toString().split(",", 6);
4569 stats1 = arrOfStr[0].substring(1);
4570 stats2 = arrOfStr[1];
4571 stats3 = arrOfStr[2];
4572 stats4 = arrOfStr[3];
4573 stats5 = arrOfStr[4];
4574 stats6 = arrOfStr[5].substring(0, arrOfStr[5].length() - 1 );
4575 // // split string to 6 set
4576 //System.out.println(stats1);
4577 String row1[] = {"HP", stats1};
4578 DefaultTableModel tb1Model1 = (DefaultTableModel)statTable1.getModel();
4579 tb1Model1.addRow(row1);
4580
4581 String row2[] = {"ATK", stats2};
4582 DefaultTableModel tb1Model2= (DefaultTableModel)statTable1.getModel();
4583 tb1Model2.addRow(row2);
4584
4585 String row3[] = {"SPA", stats3};
4586 DefaultTableModel tb1Model3 = (DefaultTableModel)statTable1.getModel();
4587 tb1Model3.addRow(row3);
4588
4589 String row4[] = {"DEF", stats4};
4590 DefaultTableModel tb1Model4 = (DefaultTableModel)statTable1.getModel();
4591 tb1Model4.addRow(row4);
4592
4593 String row5[] = {"SPD", stats5};
4594 DefaultTableModel tb1Model5 = (DefaultTableModel)statTable1.getModel();
4595 tb1Model5.addRow(row5);
4596
4597 String row6[] = {"SPE", stats6};
4598 DefaultTableModel tb1Model6 = (DefaultTableModel)statTable1.getModel();
4599 tb1Model6.addRow(row6);
4600
4601
4602 }
4603 });
4604
4605 } catch (FileNotFoundException e) {
4606 e.printStackTrace();
4607 } catch (IOException e) {
4608 e.printStackTrace();
4609 } catch (ParseException e) {
4610 e.printStackTrace();
4611 }
4612 }
4613
4614 private void startGameButtonMouseReleased(java.awt.event.MouseEvent evt) {
4615 // TODO add your handling code here:
4616 String teamlist = (String) yourTeamComboBox.getSelectedItem();
4617 ArrayList<String> arr = new ArrayList<String>();
4618 ArrayList<String> arrayCounter = new ArrayList<String>();
4619 ArrayList<String> arrayHavaCounter = new ArrayList<String>();
4620
4621 ArrayList<String> arrayThreats = new ArrayList<String>();
4622 ArrayList<String> arrayThreatsHavaCounter = new ArrayList<String>();
4623 String yourpokemon1 = null;
4624 String yourpokemon2 = null;
4625 String yourpokemon3 = null;
4626 String yourpokemon4 = null;
4627 String yourpokemon5 = null;
4628 String yourpokemon6 = null;
4629 try {
4630 File myObj = new File(teamlist);
4631 Scanner myReader = new Scanner(myObj);
4632 String yourpokemon = Files.readAllLines(Paths.get(teamlist)).get(0);
4633
4634 // split string to 6 set
4635 String[] arrOfStr = yourpokemon.split(", ", 6);
4636 yourpokemon1 = arrOfStr[0].substring(1);
4637 yourpokemon2 = arrOfStr[1];
4638 yourpokemon3 = arrOfStr[2];
4639 yourpokemon4 = arrOfStr[3];
4640 yourpokemon5 = arrOfStr[4];
4641 yourpokemon6 = arrOfStr[5].substring(0, arrOfStr[5].length() - 1 );
4642 // split string to 6 set
4643
4644 // your directory
4645 File f = new File("./src/Note");
4646 File[] matchingFiles = f.listFiles(new FilenameFilter() {
4647 public boolean accept(File dir, String name) {
4648 return name.endsWith("txt");
4649 }
4650 });
4651
4652 for (int i=0; i<matchingFiles.length; i++)
4653 {
4654 try {
4655 String opponentpokemon = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(5);
4656
4657 // //System.out.println(opponentpokemon );
4658 if(this.pokemon1.equals(opponentpokemon))
4659 {
4660 String notename = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(0);
4661 // String adviceText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(2);
4662 // String predictText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(6);
4663 // this.noteAdvice = adviceText;
4664 // this.notePredict = predictText;
4665 arr.add(matchingFiles[i].toString());
4666 }
4667 else if(this.pokemon2.equals(opponentpokemon))
4668 {
4669 String notename = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(0);
4670 // String adviceText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(2);
4671 // String predictText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(6);
4672 // this.noteAdvice = adviceText;
4673 // this.notePredict = predictText;
4674 arr.add(matchingFiles[i].toString());
4675 }
4676 else if(this.pokemon3.equals(opponentpokemon))
4677 {
4678 String notename = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(0);
4679 // String adviceText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(2);
4680 // String predictText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(6);
4681 // this.noteAdvice = adviceText;
4682 // this.notePredict = predictText;
4683 arr.add(matchingFiles[i].toString());
4684 }
4685 else if(this.pokemon4.equals(opponentpokemon))
4686 {
4687 String notename = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(0);
4688 // String adviceText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(2);
4689 // String predictText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(6);
4690 // this.noteAdvice = adviceText;
4691 // this.notePredict = predictText;
4692 arr.add(matchingFiles[i].toString());
4693 }
4694 else if(this.pokemon5.equals(opponentpokemon))
4695 {
4696 String notename = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(0);
4697 // String adviceText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(2);
4698 // String predictText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(6);
4699 // this.noteAdvice = adviceText;
4700 // this.notePredict = predictText;
4701 arr.add(matchingFiles[i].toString());
4702 }
4703 else if(this.pokemon6.equals(opponentpokemon))
4704 {
4705 String notename = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(0);
4706 // String adviceText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(2);
4707 // String predictText = Files.readAllLines(Paths.get(matchingFiles[i].toString())).get(6);
4708 // this.noteAdvice = adviceText;
4709 // this.notePredict = predictText;
4710 arr.add(matchingFiles[i].toString());
4711 }
4712 } catch (IOException ex) {
4713 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
4714 }
4715 }
4716
4717 /* While Loop impoImportant Counter Pokemon*/
4718 //System.out.println("While Loop impoImportant Counter Pokemon");
4719 int count = 0;
4720 while (arr.size() > count) {
4721 String notename = Files.readAllLines(Paths.get(arr.get(count))).get(4);
4722 String threats = Files.readAllLines(Paths.get(arr.get(count))).get(8);
4723 String[] parts = notename.split(", ");
4724 String[] partsThreats = threats.split(", ");
4725 int num = 0;
4726 int num2 = 0;
4727 // arrayCounter.add(parts[0].toString());
4728 // arrayCounter.add(parts[1].toString());
4729 // arrayCounter.add(parts[2].toString());
4730 while(parts.length > num)
4731 {
4732 arrayCounter.add(parts[num].toString());
4733 num++;
4734 }
4735
4736 while(partsThreats.length > num2)
4737 {
4738 arrayThreats.add(partsThreats[num2].toString());
4739 num2++;
4740 }
4741
4742 //
4743 count++;
4744 }
4745 //System.out.println(arrayCounter);
4746 //System.out.println(arrayThreats);
4747 /* While Loop impoImportant Counter Pokemon*/
4748 //
4749 /* for Loop impoImportant Counter Pokemon have or not*/
4750 for (int counter = 0; counter < arrayCounter.size(); counter++) {
4751 if(yourpokemon1.equals(arrayCounter.get(counter)))
4752 {
4753 arrayHavaCounter.add(yourpokemon1);
4754 yourPredictionNextMoveTF.setText(this.notePredict);
4755 yourAdvisedNextMoveTF.setText(this.noteAdvice);
4756 }
4757 else if(yourpokemon2.equals(arrayCounter.get(counter)))
4758 {
4759 arrayHavaCounter.add(yourpokemon2);
4760 yourPredictionNextMoveTF.setText(this.notePredict);
4761 yourAdvisedNextMoveTF.setText(this.noteAdvice);
4762 }
4763 else if(yourpokemon3.equals(arrayCounter.get(counter)))
4764 {
4765 arrayHavaCounter.add(yourpokemon3);
4766 yourPredictionNextMoveTF.setText(this.notePredict);
4767 yourAdvisedNextMoveTF.setText(this.noteAdvice);
4768
4769 }
4770 else if(yourpokemon4.equals(arrayCounter.get(counter)))
4771 {
4772 arrayHavaCounter.add(yourpokemon4);
4773 yourPredictionNextMoveTF.setText(this.notePredict);
4774 yourAdvisedNextMoveTF.setText(this.noteAdvice);
4775 }
4776 else if(yourpokemon5.equals(arrayCounter.get(counter)))
4777 {
4778 arrayHavaCounter.add(yourpokemon5);
4779 yourPredictionNextMoveTF.setText(this.notePredict);
4780 yourAdvisedNextMoveTF.setText(this.noteAdvice);
4781 }
4782 else if(yourpokemon6.equals(arrayCounter.get(counter)))
4783 {
4784 arrayHavaCounter.add(yourpokemon6);
4785 yourPredictionNextMoveTF.setText(this.notePredict);
4786 yourAdvisedNextMoveTF.setText(this.noteAdvice);
4787 }
4788 }
4789 String importent = arrayHavaCounter.toString();
4790 String cutname = importent.substring(1, importent.length() - 1);
4791 importantPokemonTF.setText(cutname);
4792
4793 if(importantPokemonTF.getText().equals(""))
4794 {
4795 this.notePredict = "";
4796 this.noteAdvice = "";
4797 }
4798
4799 // //System.out.println(importantPokemonTF.getText());
4800
4801 /* for Loop impoImportant Counter Pokemon have or not*/
4802
4803 /* for Loop threats Counter Pokemon have or not*/
4804 for (int counter2 = 0; counter2 < arrayThreats.size(); counter2++) {
4805 if(this.pokemon1.equals(arrayThreats.get(counter2)))
4806 {
4807 arrayThreatsHavaCounter.add(this.pokemon1);
4808 }
4809 else if(this.pokemon2.equals(arrayThreats.get(counter2)))
4810 {
4811 arrayThreatsHavaCounter.add(this.pokemon2);
4812 }
4813 else if(this.pokemon3.equals(arrayThreats.get(counter2)))
4814 {
4815 arrayThreatsHavaCounter.add(this.pokemon3);
4816 }
4817 else if(this.pokemon4.equals(arrayThreats.get(counter2)))
4818 {
4819 arrayThreatsHavaCounter.add(this.pokemon4);
4820 }
4821 else if(this.pokemon5.equals(arrayThreats.get(counter2)))
4822 {
4823 arrayThreatsHavaCounter.add(this.pokemon5);
4824 }
4825 else if(this.pokemon6.equals(arrayThreats.get(counter2)))
4826 {
4827 arrayThreatsHavaCounter.add(this.pokemon6);
4828 }
4829 }
4830 //System.out.println(arrayThreatsHavaCounter);
4831 String threats = arrayThreatsHavaCounter.toString();
4832 String cutthreats = threats.substring(1, threats.length() - 1);
4833 threatsTF.setText(cutthreats);
4834 /* for Loop threats Counter Pokemon have or not*/
4835
4836
4837 }catch (FileNotFoundException e) {
4838 // errorTF.setText("Can't find team name!");
4839 JOptionPane.showMessageDialog(null, "Can't find note name!");
4840 // //System.out.println("An error occurred.");
4841 e.printStackTrace();
4842 }catch (IOException ex) {
4843 Logger.getLogger(Prototype.class.getName()).log(Level.SEVERE, null, ex);
4844 }
4845
4846
4847
4848 }
4849
4850 private void endGameButtonMouseReleased(java.awt.event.MouseEvent evt) {
4851 // TODO add your handling code here:
4852 yourPredictionNextMoveTF.setText("");
4853 yourAdvisedNextMoveTF.setText("");
4854 importantPokemonTF.setText("");
4855 threatsTF.setText("");
4856 yourWeaknessTable.setText("");
4857 opponentWeaknessTable.setText("");
4858 statTable1.setModel(new DefaultTableModel(null, new String[]{"Stats Type", "Base Stats"}));
4859 JOptionPane.showMessageDialog(null, "End Game!");
4860 this.start_ = false;
4861 }
4862
4863 public void stringArrayTest(String data) throws IOException, ClassNotFoundException, DecoderException {
4864 String[] strs = new String[] {"test 1", "test 2", "test 3"};
4865 //System.out.println(Arrays.toString(strs));
4866
4867 // serialize
4868 ByteArrayOutputStream out = new ByteArrayOutputStream();
4869 new ObjectOutputStream(out).writeObject(strs);
4870
4871 // your string
4872 String yourString = new String(Hex.encodeHex(out.toByteArray()));
4873 //System.out.println(yourString);
4874
4875 // deserialize
4876 ByteArrayInputStream in = new ByteArrayInputStream(Hex.decodeHex(yourString.toCharArray()));
4877 // Arrays.toString((String[]) new ObjectInputStream(in).readObject());
4878 // //System.out.println(new ObjectInputStream(in).readObject());
4879 // //System.out.println(Arrays.toString((String[]) new ObjectInputStream(in).readObject()));
4880 }
4881
4882 /**
4883 * @param args the command line arguments
4884 */
4885 public static void main(String args[]) throws IOException {
4886 /* Set the Nimbus look and feel */
4887 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
4888 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
4889 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
4890 */
4891
4892 try {
4893 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
4894 if ("Nimbus".equals(info.getName())) {
4895 javax.swing.UIManager.setLookAndFeel(info.getClassName());
4896 break;
4897 }
4898 }
4899 } catch (ClassNotFoundException ex) {
4900 java.util.logging.Logger.getLogger(Prototype.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
4901 } catch (InstantiationException ex) {
4902 java.util.logging.Logger.getLogger(Prototype.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
4903 } catch (IllegalAccessException ex) {
4904 java.util.logging.Logger.getLogger(Prototype.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
4905 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
4906 java.util.logging.Logger.getLogger(Prototype.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
4907 }
4908 //</editor-fold>
4909
4910 /* Create and display the form */
4911 java.awt.EventQueue.invokeLater(new Runnable() {
4912 public void run() {
4913 new Prototype().setVisible(true);
4914
4915 }
4916 });
4917 }
4918
4919
Sample Generated Codes from NetBeans
4920
4921
4922 // <editor-fold defaultstate="collapsed" desc="Generated Code">
113 private void initComponents() {
114
115 jScrollPane2 = new javax.swing.JScrollPane();
116 jTable2 = new javax.swing.JTable();
117 popupMenu1 = new java.awt.PopupMenu();
118 statSP = new javax.swing.JScrollPane();
119 statTable = new javax.swing.JTable();
120 jMenuItem1 = new javax.swing.JMenuItem();
121 moveAdviserPanel = new javax.swing.JTabbedPane();
122 jPanel1 = new javax.swing.JPanel();
123 inputTF = new javax.swing.JTextField();
124 inputLabel = new javax.swing.JLabel();
125 predictedOpponentNextMoveLabel = new javax.swing.JLabel();
126 yourTeamLabel = new javax.swing.JLabel();
127 yourAdvisedNextMoveLabel = new javax.swing.JLabel();
128 importantPokemonLabel = new javax.swing.JLabel();
129 statSP1 = new javax.swing.JScrollPane();
130 statTable1 = new javax.swing.JTable();
131 pokemonStatLabel = new javax.swing.JLabel();
132 pokemonStatCheckBox = new javax.swing.JComboBox<>();
133 yourWeaknessLabel = new javax.swing.JLabel();
134 opponentWeaknessLabel = new javax.swing.JLabel();
135 threatsLabel = new javax.swing.JLabel();
136 processInputButton = new javax.swing.JButton();
137 jLabel1 = new javax.swing.JLabel();
138 possibleMovesComboBox = new javax.swing.JComboBox<>();
139 possibleMovesTF = new javax.swing.JTextField();
140 pasteInputButton = new javax.swing.JButton();
141 startGameButton = new javax.swing.JButton();
142 endGameButton = new javax.swing.JButton();
143 yourTeamComboBox = new javax.swing.JComboBox<>();
144 jScrollPane9 = new javax.swing.JScrollPane();
145 yourPredictionNextMoveTF = new javax.swing.JTextArea();
146 jScrollPane11 = new javax.swing.JScrollPane();
147 importantPokemonTF = new javax.swing.JTextArea();
148 jScrollPane12 = new javax.swing.JScrollPane();
149 threatsTF = new javax.swing.JTextArea();
150 jScrollPane13 = new javax.swing.JScrollPane();
151 yourWeaknessTable = new javax.swing.JTextArea();
152 jScrollPane14 = new javax.swing.JScrollPane();
153 opponentWeaknessTable = new javax.swing.JTextArea();
154 jScrollPane15 = new javax.swing.JScrollPane();
155 yourAdvisedNextMoveTF = new javax.swing.JTextArea();
156 jPanel2 = new javax.swing.JPanel();
157 jLabel20 = new javax.swing.JLabel();
158 yourPokemonTF = new javax.swing.JTextField();
159 jLabel21 = new javax.swing.JLabel();
160 opponentPokemonTF = new javax.swing.JTextField();
161 jLabel22 = new javax.swing.JLabel();
162 jLabel23 = new javax.swing.JLabel();
163 possibleThreatLabel = new javax.swing.JLabel();
164 importantCounterLabel = new javax.swing.JLabel();
165 noteNameLabel = new javax.swing.JLabel();
166 noteNameTF = new javax.swing.JTextField();
167 saveNoteButton = new javax.swing.JButton();
168 searchTextTF = new javax.swing.JTextField();
169 searchTextButton = new javax.swing.JButton();
170 pokemonSearchRB = new javax.swing.JRadioButton();
171 noteNameSearchRB = new javax.swing.JRadioButton();
172 searchTextLabel1 = new javax.swing.JLabel();
173 jScrollPane3 = new javax.swing.JScrollPane();
174 possibleThreatTA = new javax.swing.JTextArea();
175 notesFoundComboBox = new javax.swing.JComboBox<>();
176 jLabel2 = new javax.swing.JLabel();
177 jScrollPane4 = new javax.swing.JScrollPane();
178 adviceTA = new javax.swing.JTextArea();
179 jScrollPane5 = new javax.swing.JScrollPane();
180 predictTA = new javax.swing.JTextArea();
181 jScrollPane8 = new javax.swing.JScrollPane();
182 importantCounterTA = new javax.swing.JTextArea();
183 jPanel3 = new javax.swing.JPanel();
184 pokemonTF = new javax.swing.JTextField();
185 jLabel3 = new javax.swing.JLabel();
186 move1TF = new javax.swing.JTextField();
187 jLabel4 = new javax.swing.JLabel();
188 jLabel8 = new javax.swing.JLabel();
189 move2TF = new javax.swing.JTextField();
190 jLabel9 = new javax.swing.JLabel();
191 move3TF = new javax.swing.JTextField();
192 jLabel10 = new javax.swing.JLabel();
193 move4TF = new javax.swing.JTextField();
194 jButton7 = new javax.swing.JButton();
195 jButton8 = new javax.swing.JButton();
196 jButton9 = new javax.swing.JButton();
197 jButton10 = new javax.swing.JButton();
198 jButton11 = new javax.swing.JButton();
199 jButton12 = new javax.swing.JButton();
200 jLabel11 = new javax.swing.JLabel();
201 itemTF = new javax.swing.JTextField();
202 jLabel12 = new javax.swing.JLabel();
203 abilityTF = new javax.swing.JTextField();
204 jLabel13 = new javax.swing.JLabel();
205 teamNameTF = new javax.swing.JTextField();
206 saveButton = new javax.swing.JButton();
207 deleteButton = new javax.swing.JButton();
208 jScrollPane1 = new javax.swing.JScrollPane();
209 allPokemonTable = new javax.swing.JTable();
210 refreshTableButton = new javax.swing.JButton();
211 errorTF = new javax.swing.JTextField();
212 searchTeamButton = new javax.swing.JButton();
213 jScrollPane10 = new javax.swing.JScrollPane();
214 teamTable = new javax.swing.JTable();
215
216 jTable2.setModel(new javax.swing.table.DefaultTableModel(
217 new Object [][] {
218 {null, null, null, null},
219 {null, null, null, null},
220 {null, null, null, null},
221 {null, null, null, null}
222 },
223 new String [] {
224 "Title 1", "Title 2", "Title 3", "Title 4"
225 }
226 ));
227 jScrollPane2.setViewportView(jTable2);
228
229 popupMenu1.setLabel("popupMenu1");
230
231 statTable.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
232 statTable.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
233 statTable.setModel(new javax.swing.table.DefaultTableModel(
234 new Object [][] {
235 {"HP", null},
236 {"ATk", null},
237 {"SPA", null},
238 {"DEF", null},
239 {"SPD", null},
240 {"SPE", null}
241 },
242 new String [] {
243 "Stat Type", "Base Sats"
244 }
245 ));
246 statTable.setGridColor(new java.awt.Color(0, 0, 0));
247 statTable.setPreferredSize(new java.awt.Dimension(300, 400));
248 statTable.setRowHeight(30);
249 statTable.setShowGrid(true);
250 statSP.setViewportView(statTable);
251
252 jMenuItem1.setText("jMenuItem1");
253
254 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
255
256 inputTF.addMouseListener(new java.awt.event.MouseAdapter() {
257 public void mouseReleased(java.awt.event.MouseEvent evt) {
258 inputTFMouseReleased(evt);
259 }
260 });
261 inputTF.addActionListener(new java.awt.event.ActionListener() {
262 public void actionPerformed(java.awt.event.ActionEvent evt) {
263 inputTFActionPerformed(evt);
264 }
265 });
266
267 inputLabel.setText("Input Texts");
268
269 predictedOpponentNextMoveLabel.setText("Predicted Opponent's Next Move");
270
271 yourTeamLabel.setText("Your Team");
272
273 yourAdvisedNextMoveLabel.setText("Your Advised Next Move and Reminder");
274
275 importantPokemonLabel.setText("Important Pokemon");
276
277 statTable1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
278 statTable1.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
279 statTable1.setModel(new javax.swing.table.DefaultTableModel(
280 new Object [][] {
281
282 },
283 new String [] {
284 "Stat Type", "Base Sats"
285 }
286 ));
287 statTable1.setGridColor(new java.awt.Color(0, 0, 0));
288 statTable1.setPreferredSize(new java.awt.Dimension(300, 400));
289 statTable1.setRowHeight(30);
290 statTable1.setShowGrid(true);
291 statSP1.setViewportView(statTable1);
292
293 pokemonStatLabel.setText("Opponent's Pokemon Stats");
294
295 pokemonStatCheckBox.addActionListener(new java.awt.event.ActionListener() {
296 public void actionPerformed(java.awt.event.ActionEvent evt) {
297 pokemonStatCheckBoxActionPerformed(evt);
298 }
299 });
300
301 yourWeaknessLabel.setText("Your Pokemon's Weakness");
302
303 opponentWeaknessLabel.setText("Opponent's Pokemon's Weakness");
304
305 threatsLabel.setText("Threats");
306
307 processInputButton.setText("Process Input");
308 processInputButton.addMouseListener(new java.awt.event.MouseAdapter() {
309 public void mouseReleased(java.awt.event.MouseEvent evt) {
310 processInputButtonMouseReleased(evt);
311 }
312 });
313
314 jLabel1.setText("Opponent's Pokemon Possible Moves");
315
316 possibleMovesComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Pokemon 1" }));
317
318 possibleMovesTF.addActionListener(new java.awt.event.ActionListener() {
319 public void actionPerformed(java.awt.event.ActionEvent evt) {
320 possibleMovesTFActionPerformed(evt);
321 }
322 });
323
324 pasteInputButton.setText("Paste Input");
325 pasteInputButton.addMouseListener(new java.awt.event.MouseAdapter() {
326 public void mouseReleased(java.awt.event.MouseEvent evt) {
327 pasteInputButtonMouseReleased(evt);
328 }
329 });
330
331 startGameButton.setText("Start Game");
332 startGameButton.addMouseListener(new java.awt.event.MouseAdapter() {
333 public void mouseReleased(java.awt.event.MouseEvent evt) {
334 startGameButtonMouseReleased(evt);
335 }
336 });
337
338 endGameButton.setText("End Game");
339 endGameButton.addMouseListener(new java.awt.event.MouseAdapter() {
340 public void mouseReleased(java.awt.event.MouseEvent evt) {
341 endGameButtonMouseReleased(evt);
342 }
343 });
344
345 yourTeamComboBox.addActionListener(new java.awt.event.ActionListener() {
346 public void actionPerformed(java.awt.event.ActionEvent evt) {
347 yourTeamComboBoxActionPerformed(evt);
348 }
349 });
350
351 yourPredictionNextMoveTF.setColumns(20);
352 yourPredictionNextMoveTF.setLineWrap(true);
353 yourPredictionNextMoveTF.setRows(5);
354 jScrollPane9.setViewportView(yourPredictionNextMoveTF);
355
356 importantPokemonTF.setEditable(false);
357 importantPokemonTF.setColumns(20);
358 importantPokemonTF.setFont(new java.awt.Font("Monospaced", 3, 14)); // NOI18N
359 importantPokemonTF.setForeground(new java.awt.Color(0, 153, 0));
360 importantPokemonTF.setLineWrap(true);
361 importantPokemonTF.setRows(5);
362 importantPokemonTF.setCaretColor(new java.awt.Color(51, 255, 0));
363 jScrollPane11.setViewportView(importantPokemonTF);
364
365 threatsTF.setEditable(false);
366 threatsTF.setColumns(20);
367 threatsTF.setFont(new java.awt.Font("Monospaced", 1, 14)); // NOI18N
368 threatsTF.setForeground(new java.awt.Color(255, 0, 0));
369 threatsTF.setRows(5);
370 jScrollPane12.setViewportView(threatsTF);
371
372 yourWeaknessTable.setColumns(20);
373 yourWeaknessTable.setLineWrap(true);
374 yourWeaknessTable.setRows(5);
375 yourWeaknessTable.setWrapStyleWord(true);
376 jScrollPane13.setViewportView(yourWeaknessTable);
377
378 opponentWeaknessTable.setColumns(20);
379 opponentWeaknessTable.setLineWrap(true);
380 opponentWeaknessTable.setRows(5);
381 opponentWeaknessTable.setWrapStyleWord(true);
382 jScrollPane14.setViewportView(opponentWeaknessTable);
383
384 yourAdvisedNextMoveTF.setColumns(20);
385 yourAdvisedNextMoveTF.setLineWrap(true);
386 yourAdvisedNextMoveTF.setRows(5);
387 yourAdvisedNextMoveTF.setWrapStyleWord(true);
388 jScrollPane15.setViewportView(yourAdvisedNextMoveTF);
389
390 javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
391 jPanel1.setLayout(jPanel1Layout);
392 jPanel1Layout.setHorizontalGroup(
393 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
394 .addGroup(jPanel1Layout.createSequentialGroup()
395 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
396 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
397 .addGroup(jPanel1Layout.createSequentialGroup()
398 .addGap(18, 18, 18)
399 .addComponent(inputTF, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE))
400 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
401 .addContainerGap()
402 .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE)))
403 .addGroup(jPanel1Layout.createSequentialGroup()
404 .addGap(18, 18, 18)
405 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
406 .addComponent(jScrollPane15, javax.swing.GroupLayout.PREFERRED_SIZE, 291, javax.swing.GroupLayout.PREFERRED_SIZE)
407 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
408 .addComponent(yourAdvisedNextMoveLabel)
409 .addComponent(yourTeamLabel)
410 .addGroup(jPanel1Layout.createSequentialGroup()
411 .addComponent(inputLabel)
412 .addGap(51, 51, 51)
413 .addComponent(pasteInputButton))
414 .addComponent(predictedOpponentNextMoveLabel)
415 .addGroup(jPanel1Layout.createSequentialGroup()
416 .addGap(6, 6, 6)
417 .addComponent(jLabel1))
418 .addComponent(possibleMovesTF)
419 .addComponent(yourTeamComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
420 .addComponent(possibleMovesComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)))))
421 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
422 .addGroup(jPanel1Layout.createSequentialGroup()
423 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
424 .addGroup(jPanel1Layout.createSequentialGroup()
425 .addGap(8, 8, 8)
426 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
427 .addGroup(jPanel1Layout.createSequentialGroup()
428 .addGap(35, 35, 35)
429 .addComponent(yourWeaknessLabel))
430 .addComponent(statSP1, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE)))
431 .addGroup(jPanel1Layout.createSequentialGroup()
432 .addGap(63, 63, 63)
433 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
434 .addComponent(pokemonStatLabel)
435 .addComponent(pokemonStatCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE))))
436 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
437 .addGroup(jPanel1Layout.createSequentialGroup()
438 .addGap(39, 39, 39)
439 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
440 .addComponent(processInputButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
441 .addComponent(startGameButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
442 .addComponent(endGameButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
443 .addGap(0, 0, Short.MAX_VALUE))
444 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
445 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
446 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
447 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
448 .addComponent(threatsLabel)
449 .addGap(173, 173, 173))
450 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
451 .addComponent(importantPokemonLabel)
452 .addGap(144, 144, 144))))))
453 .addGroup(jPanel1Layout.createSequentialGroup()
454 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
455 .addGroup(jPanel1Layout.createSequentialGroup()
456 .addGap(10, 10, 10)
457 .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))
458 .addGroup(jPanel1Layout.createSequentialGroup()
459 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
460 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
461 .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE)
462 .addComponent(opponentWeaknessLabel))))
463 .addGap(18, 18, 18)
464 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
465 .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
466 .addComponent(jScrollPane12))
467 .addContainerGap())))
468 );
469 jPanel1Layout.setVerticalGroup(
470 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
471 .addGroup(jPanel1Layout.createSequentialGroup()
472 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
473 .addGroup(jPanel1Layout.createSequentialGroup()
474 .addContainerGap()
475 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
476 .addComponent(inputLabel)
477 .addComponent(pasteInputButton))
478 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
479 .addComponent(inputTF, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
480 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
481 .addComponent(yourTeamLabel)
482 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
483 .addComponent(yourTeamComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
484 .addGap(19, 19, 19)
485 .addComponent(predictedOpponentNextMoveLabel)
486 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
487 .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
488 .addGap(30, 30, 30)
489 .addComponent(yourAdvisedNextMoveLabel)
490 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
491 .addComponent(jScrollPane15, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
492 .addGap(18, 18, 18)
493 .addComponent(jLabel1)
494 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
495 .addComponent(possibleMovesComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
496 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
497 .addComponent(possibleMovesTF, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE))
498 .addGroup(jPanel1Layout.createSequentialGroup()
499 .addGap(5, 5, 5)
500 .addComponent(pokemonStatLabel)
501 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
502 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
503 .addComponent(pokemonStatCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
504 .addComponent(importantPokemonLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
505 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
506 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
507 .addComponent(statSP1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
508 .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE))
509 .addGap(3, 3, 3)
510 .addComponent(yourWeaknessLabel)
511 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
512 .addGroup(jPanel1Layout.createSequentialGroup()
513 .addGap(2, 2, 2)
514 .addComponent(threatsLabel)
515 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
516 .addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
517 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
518 .addComponent(processInputButton)
519 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
520 .addComponent(startGameButton)
521 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
522 .addComponent(endGameButton)
523 .addGap(0, 0, Short.MAX_VALUE))
524 .addGroup(jPanel1Layout.createSequentialGroup()
525 .addGap(18, 18, 18)
526 .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE)
527 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
528 .addComponent(opponentWeaknessLabel)
529 .addGap(18, 18, 18)
530 .addComponent(jScrollPane14)))))
531 .addContainerGap())
532 );
533
534 moveAdviserPanel.addTab("Move Adviser", jPanel1);
535
536 jPanel2.setLayout(null);
537
538 jLabel20.setText("Your Pokemon");
539 jPanel2.add(jLabel20);
540 jLabel20.setBounds(80, 42, 130, 16);
541
542 yourPokemonTF.addMouseListener(new java.awt.event.MouseAdapter() {
543 public void mouseReleased(java.awt.event.MouseEvent evt) {
544 yourPokemonTFMouseReleased(evt);
545 }
546 });
547 jPanel2.add(yourPokemonTF);
548 yourPokemonTF.setBounds(40, 64, 165, 30);
549
550 jLabel21.setText("Opponent's Pokemon");
551 jPanel2.add(jLabel21);
552 jLabel21.setBounds(590, 40, 170, 16);
553 jPanel2.add(opponentPokemonTF);
554 opponentPokemonTF.setBounds(590, 60, 165, 30);
555
556 jLabel22.setText("What Your Opponent Will Do");
557 jPanel2.add(jLabel22);
558 jLabel22.setBounds(590, 150, 200, 16);
559
560 jLabel23.setText("What You Should Do");
561 jPanel2.add(jLabel23);
562 jLabel23.setBounds(50, 150, 165, 16);
563
564 possibleThreatLabel.setText("Other Possible Threat");
565 jPanel2.add(possibleThreatLabel);
566 possibleThreatLabel.setBounds(620, 590, 160, 16);
567
568 importantCounterLabel.setText("Important Counter Pokemon");
569 jPanel2.add(importantCounterLabel);
570 importantCounterLabel.setBounds(30, 590, 210, 16);
571
572 noteNameLabel.setText("Note Name");
573 jPanel2.add(noteNameLabel);
574 noteNameLabel.setBounds(360, 40, 80, 16);
575 jPanel2.add(noteNameTF);
576 noteNameTF.setBounds(310, 58, 170, 30);
577
578 saveNoteButton.setText("Save");
579 saveNoteButton.addMouseListener(new java.awt.event.MouseAdapter() {
580 public void mouseReleased(java.awt.event.MouseEvent evt) {
581 saveNoteButtonMouseReleased(evt);
582 }
583 });
584 jPanel2.add(saveNoteButton);
585 saveNoteButton.setBounds(361, 96, 75, 29);
586 jPanel2.add(searchTextTF);
587 searchTextTF.setBounds(260, 280, 180, 30);
588
589 searchTextButton.setText("Search");
590 searchTextButton.addMouseListener(new java.awt.event.MouseAdapter() {
591 public void mousePressed(java.awt.event.MouseEvent evt) {
592 searchTextButtonMousePressed(evt);
593 }
594 public void mouseReleased(java.awt.event.MouseEvent evt) {
595 searchTextButtonMouseReleased(evt);
596 }
597 });
598 jPanel2.add(searchTextButton);
599 searchTextButton.setBounds(460, 280, 100, 29);
600
601 pokemonSearchRB.setText("Search by Pokemon Name");
602 jPanel2.add(pokemonSearchRB);
603 pokemonSearchRB.setBounds(300, 172, 194, 23);
604
605 noteNameSearchRB.setText("Search by Note Name");
606 jPanel2.add(noteNameSearchRB);
607 noteNameSearchRB.setBounds(300, 213, 166, 23);
608
609 searchTextLabel1.setText("Search Text");
610 jPanel2.add(searchTextLabel1);
611 searchTextLabel1.setBounds(370, 250, 90, 16);
612
613 possibleThreatTA.setLineWrap(true);
614 possibleThreatTA.setColumns(20);
615 possibleThreatTA.setLineWrap(true);
616 possibleThreatTA.setRows(5);
617 jScrollPane3.setViewportView(possibleThreatTA);
618
619 jPanel2.add(jScrollPane3);
620 jScrollPane3.setBounds(580, 620, 220, 130);
621
622 notesFoundComboBox.setToolTipText("");
623 notesFoundComboBox.addActionListener(new java.awt.event.ActionListener() {
624 public void actionPerformed(java.awt.event.ActionEvent evt) {
625 notesFoundComboBoxActionPerformed(evt);
626 }
627 });
628 jPanel2.add(notesFoundComboBox);
629 notesFoundComboBox.setBounds(360, 330, 200, 27);
630
631 jLabel2.setText("Notes Found");
632 jPanel2.add(jLabel2);
633 jLabel2.setBounds(260, 330, 90, 16);
634
635 possibleThreatTA.setLineWrap(true);
636 adviceTA.setColumns(20);
637 adviceTA.setLineWrap(true);
638 adviceTA.setRows(5);
639 adviceTA.setWrapStyleWord(true);
640 jScrollPane4.setViewportView(adviceTA);
641
642 jPanel2.add(jScrollPane4);
643 jScrollPane4.setBounds(20, 180, 220, 380);
644
645 possibleThreatTA.setLineWrap(true);
646 predictTA.setColumns(20);
647 predictTA.setLineWrap(true);
648 predictTA.setRows(5);
649 jScrollPane5.setViewportView(predictTA);
650
651 jPanel2.add(jScrollPane5);
652 jScrollPane5.setBounds(570, 180, 220, 380);
653
654 possibleThreatTA.setLineWrap(true);
655 importantCounterTA.setColumns(20);
656 importantCounterTA.setLineWrap(true);
657 importantCounterTA.setRows(5);
658 jScrollPane8.setViewportView(importantCounterTA);
659
660 jPanel2.add(jScrollPane8);
661 jScrollPane8.setBounds(10, 620, 220, 130);
662
663 moveAdviserPanel.addTab("Notes", jPanel2);
664
665 jLabel3.setText("Pokemon");
666
667 jLabel4.setText("Move 1");
668
669 jLabel8.setText("Move 2");
670
671 jLabel9.setText("Move 3");
672
673 jLabel10.setText("Move 4");
674
675 jButton7.setText("Pokemon 1");
676 jButton7.addMouseListener(new java.awt.event.MouseAdapter() {
677 public void mouseReleased(java.awt.event.MouseEvent evt) {
678 jButton7MouseReleased(evt);
679 }
680 });
681
682 jButton8.setText("Pokemon 2");
683 jButton8.addMouseListener(new java.awt.event.MouseAdapter() {
684 public void mouseReleased(java.awt.event.MouseEvent evt) {
685 jButton8MouseReleased(evt);
686 }
687 });
688 jButton8.addActionListener(new java.awt.event.ActionListener() {
689 public void actionPerformed(java.awt.event.ActionEvent evt) {
690 jButton8ActionPerformed(evt);
691 }
692 });
693
694 jButton9.setText("Pokemon 3");
695 jButton9.addMouseListener(new java.awt.event.MouseAdapter() {
696 public void mouseReleased(java.awt.event.MouseEvent evt) {
697 jButton9MouseReleased(evt);
698 }
699 });
700
701 jButton10.setText("Pokemon 4");
702 jButton10.addMouseListener(new java.awt.event.MouseAdapter() {
703 public void mouseReleased(java.awt.event.MouseEvent evt) {
704 jButton10MouseReleased(evt);
705 }
706 });
707
708 jButton11.setText("Pokemon 5");
709 jButton11.addMouseListener(new java.awt.event.MouseAdapter() {
710 public void mouseReleased(java.awt.event.MouseEvent evt) {
711 jButton11MouseReleased(evt);
712 }
713 });
714
715 jButton12.setText("Pokemon 6");
716 jButton12.addMouseListener(new java.awt.event.MouseAdapter() {
717 public void mouseReleased(java.awt.event.MouseEvent evt) {
718 jButton12MouseReleased(evt);
719 }
720 });
721
722 jLabel11.setText("Item");
723
724 jLabel12.setText("Ability");
725
726 jLabel13.setText("Team Name");
727
728 saveButton.setText("Save");
729 saveButton.addMouseListener(new java.awt.event.MouseAdapter() {
730 public void mouseReleased(java.awt.event.MouseEvent evt) {
731 saveButtonMouseReleased(evt);
732 }
733 });
734
735 deleteButton.setText("Delete");
736 deleteButton.addMouseListener(new java.awt.event.MouseAdapter() {
737 public void mouseReleased(java.awt.event.MouseEvent evt) {
738 deleteButtonMouseReleased(evt);
739 }
740 });
741
742 allPokemonTable.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
743 allPokemonTable.setModel(new javax.swing.table.DefaultTableModel(
744 new Object [][] {
745
746 },
747 new String [] {
748 "Pokemon", "Move 1", "Move 2", "Move 3", "Move 4", "Item", "Ability"
749 }
750 ) {
751 boolean[] canEdit = new boolean [] {
752 false, false, false, false, false, false, false
753 };
754
755 public boolean isCellEditable(int rowIndex, int columnIndex) {
756 return canEdit [columnIndex];
757 }
758 });
759 allPokemonTable.setGridColor(new java.awt.Color(0, 0, 0));
760 allPokemonTable.setRowHeight(20);
761 allPokemonTable.setShowGrid(true);
762 jScrollPane1.setViewportView(allPokemonTable);
763 if (allPokemonTable.getColumnModel().getColumnCount() > 0) {
764 allPokemonTable.getColumnModel().getColumn(0).setResizable(false);
765 allPokemonTable.getColumnModel().getColumn(1).setResizable(false);
766 allPokemonTable.getColumnModel().getColumn(2).setResizable(false);
767 allPokemonTable.getColumnModel().getColumn(3).setResizable(false);
768 allPokemonTable.getColumnModel().getColumn(4).setResizable(false);
769 allPokemonTable.getColumnModel().getColumn(5).setResizable(false);
770 allPokemonTable.getColumnModel().getColumn(6).setResizable(false);
771 }
772
773 refreshTableButton.setText("Refresh Table");
774
775 errorTF.setEditable(false);
776 errorTF.setForeground(new java.awt.Color(255, 0, 0));
777
778 searchTeamButton.setText("Search");
779 searchTeamButton.addMouseListener(new java.awt.event.MouseAdapter() {
780 public void mouseReleased(java.awt.event.MouseEvent evt) {
781 searchTeamButtonMouseReleased(evt);
782 }
783 });
784
785 teamTable.setModel(new javax.swing.table.DefaultTableModel(
786 new Object [][] {
787 {null}
788 },
789 new String [] {
790 "Team"
791 }
792 ) {
793 boolean[] canEdit = new boolean [] {
794 false
795 };
796
797 public boolean isCellEditable(int rowIndex, int columnIndex) {
798 return canEdit [columnIndex];
799 }
800 });
801 jScrollPane10.setViewportView(teamTable);
802 if (teamTable.getColumnModel().getColumnCount() > 0) {
803 teamTable.getColumnModel().getColumn(0).setResizable(false);
804 }
805
806 javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
807 jPanel3.setLayout(jPanel3Layout);
808 jPanel3Layout.setHorizontalGroup(
809 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
810 .addGroup(jPanel3Layout.createSequentialGroup()
811 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
812 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
813 .addGroup(jPanel3Layout.createSequentialGroup()
814 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
815 .addGroup(jPanel3Layout.createSequentialGroup()
816 .addGap(24, 24, 24)
817 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
818 .addComponent(jButton8, javax.swing.GroupLayout.Alignment.TRAILING)
819 .addComponent(jButton9, javax.swing.GroupLayout.Alignment.TRAILING)
820 .addComponent(jButton10, javax.swing.GroupLayout.Alignment.TRAILING)
821 .addComponent(jButton11, javax.swing.GroupLayout.Alignment.TRAILING)))
822 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
823 .addContainerGap()
824 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
825 .addComponent(jButton12, javax.swing.GroupLayout.Alignment.TRAILING)
826 .addComponent(jButton7, javax.swing.GroupLayout.Alignment.TRAILING))))
827 .addGap(25, 25, 25)
828 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
829 .addGroup(jPanel3Layout.createSequentialGroup()
830 .addComponent(jLabel9)
831 .addGap(18, 18, 18)
832 .addComponent(move3TF, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
833 .addGroup(jPanel3Layout.createSequentialGroup()
834 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
835 .addComponent(jLabel12)
836 .addComponent(jLabel10)
837 .addComponent(jLabel11))
838 .addGap(18, 18, 18)
839 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
840 .addComponent(move4TF, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
841 .addComponent(itemTF)
842 .addComponent(abilityTF)))))
843 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
844 .addGroup(jPanel3Layout.createSequentialGroup()
845 .addGap(18, 18, 18)
846 .addComponent(jLabel3)
847 .addGap(12, 12, 12)
848 .addComponent(pokemonTF, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
849 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
850 .addComponent(jLabel8)
851 .addGap(18, 18, 18)
852 .addComponent(move2TF, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))))
853 .addGroup(jPanel3Layout.createSequentialGroup()
854 .addGap(125, 125, 125)
855 .addComponent(jLabel4)
856 .addGap(25, 25, 25)
857 .addComponent(move1TF, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)))
858 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
859 .addGroup(jPanel3Layout.createSequentialGroup()
860 .addGap(37, 37, 37)
861 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
862 .addGroup(jPanel3Layout.createSequentialGroup()
863 .addComponent(jLabel13)
864 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
865 .addComponent(teamNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE))
866 .addGroup(jPanel3Layout.createSequentialGroup()
867 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
868 .addGroup(jPanel3Layout.createSequentialGroup()
869 .addGap(63, 63, 63)
870 .addComponent(refreshTableButton)
871 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
872 .addGroup(jPanel3Layout.createSequentialGroup()
873 .addComponent(saveButton)
874 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
875 .addComponent(searchTeamButton)
876 .addGap(21, 21, 21)))
877 .addComponent(deleteButton))))
878 .addGroup(jPanel3Layout.createSequentialGroup()
879 .addGap(75, 75, 75)
880 .addComponent(errorTF, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)))
881 .addContainerGap(173, Short.MAX_VALUE))
882 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
883 .addContainerGap(37, Short.MAX_VALUE)
884 .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
885 .addGap(31, 31, 31)
886 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 612, javax.swing.GroupLayout.PREFERRED_SIZE))
887 );
888 jPanel3Layout.setVerticalGroup(
889 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
890 .addGroup(jPanel3Layout.createSequentialGroup()
891 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
892 .addGroup(jPanel3Layout.createSequentialGroup()
893 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
894 .addGroup(jPanel3Layout.createSequentialGroup()
895 .addGap(22, 22, 22)
896 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
897 .addComponent(jLabel13)
898 .addComponent(teamNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
899 .addGap(4, 4, 4))
900 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
901 .addContainerGap()
902 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
903 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
904 .addComponent(pokemonTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
905 .addComponent(jLabel3))
906 .addComponent(jButton7))
907 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
908 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
909 .addComponent(move1TF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
910 .addComponent(jLabel4)
911 .addComponent(jButton8))
912 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
913 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
914 .addComponent(move2TF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
915 .addComponent(jLabel8)
916 .addComponent(jButton9)
917 .addComponent(saveButton)
918 .addComponent(deleteButton)
919 .addComponent(searchTeamButton))
920 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
921 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
922 .addComponent(move3TF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
923 .addComponent(jLabel9)
924 .addComponent(jButton10))
925 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
926 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
927 .addComponent(move4TF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
928 .addComponent(jLabel10)
929 .addComponent(jButton11))
930 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
931 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
932 .addComponent(errorTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
933 .addGap(15, 15, 15)))
934 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
935 .addComponent(jButton12)
936 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
937 .addComponent(itemTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
938 .addComponent(jLabel11)))
939 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
940 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
941 .addComponent(abilityTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
942 .addComponent(jLabel12)
943 .addComponent(refreshTableButton))
944 .addGap(66, 66, 66)
945 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
946 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
947 .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE))
948 .addContainerGap(205, Short.MAX_VALUE))
949 );
950
951 moveAdviserPanel.addTab("Set Team", jPanel3);
952
953 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
954 getContentPane().setLayout(layout);
955 layout.setHorizontalGroup(
956 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
957 .addGroup(layout.createSequentialGroup()
958 .addContainerGap()
959 .addComponent(moveAdviserPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 825, javax.swing.GroupLayout.PREFERRED_SIZE)
960 .addContainerGap(30, Short.MAX_VALUE))
961 );
962 layout.setVerticalGroup(
963 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
964 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
965 .addContainerGap()
966 .addComponent(moveAdviserPanel)
967 .addContainerGap())
968 );
969
970 pack();
4923
4924 // Variables declaration - do not modify
4925 private javax.swing.JTextField abilityTF;
4926 private javax.swing.JTextArea adviceTA;
4927 private javax.swing.JTable allPokemonTable;
4928 private javax.swing.JButton deleteButton;
4929 private javax.swing.JButton endGameButton;
4930 private javax.swing.JTextField errorTF;
4931 private javax.swing.JLabel importantCounterLabel;
4932 private javax.swing.JTextArea importantCounterTA;
4933 private javax.swing.JLabel importantPokemonLabel;
4934 private javax.swing.JTextArea importantPokemonTF;
4935 private javax.swing.JLabel inputLabel;
4936 private javax.swing.JTextField inputTF;
4937 private javax.swing.JTextField itemTF;
4938 private javax.swing.JButton jButton10;
4939 private javax.swing.JButton jButton11;
4940 private javax.swing.JButton jButton12;
4941 private javax.swing.JButton jButton7;
4942 private javax.swing.JButton jButton8;
4943 private javax.swing.JButton jButton9;
4944 private javax.swing.JLabel jLabel1;
4945 private javax.swing.JLabel jLabel10;
4946 private javax.swing.JLabel jLabel11;
4947 private javax.swing.JLabel jLabel12;
4948 private javax.swing.JLabel jLabel13;
4949 private javax.swing.JLabel jLabel2;
4950 private javax.swing.JLabel jLabel20;
4951 private javax.swing.JLabel jLabel21;
4952 private javax.swing.JLabel jLabel22;
4953 private javax.swing.JLabel jLabel23;
4954 private javax.swing.JLabel jLabel3;
4955 private javax.swing.JLabel jLabel4;
4956 private javax.swing.JLabel jLabel8;
4957 private javax.swing.JLabel jLabel9;
4958 private javax.swing.JMenuItem jMenuItem1;
4959 private javax.swing.JPanel jPanel1;
4960 private javax.swing.JPanel jPanel2;
4961 private javax.swing.JPanel jPanel3;
4962 private javax.swing.JScrollPane jScrollPane1;
4963 private javax.swing.JScrollPane jScrollPane10;
4964 private javax.swing.JScrollPane jScrollPane11;
4965 private javax.swing.JScrollPane jScrollPane12;
4966 private javax.swing.JScrollPane jScrollPane13;
4967 private javax.swing.JScrollPane jScrollPane14;
4968 private javax.swing.JScrollPane jScrollPane15;
4969 private javax.swing.JScrollPane jScrollPane2;
4970 private javax.swing.JScrollPane jScrollPane3;
4971 private javax.swing.JScrollPane jScrollPane4;
4972 private javax.swing.JScrollPane jScrollPane5;
4973 private javax.swing.JScrollPane jScrollPane8;
4974 private javax.swing.JScrollPane jScrollPane9;
4975 private javax.swing.JTable jTable2;
4976 private javax.swing.JTextField move1TF;
4977 private javax.swing.JTextField move2TF;
4978 private javax.swing.JTextField move3TF;
4979 private javax.swing.JTextField move4TF;
4980 private javax.swing.JTabbedPane moveAdviserPanel;
4981 private javax.swing.JLabel noteNameLabel;
4982 private javax.swing.JRadioButton noteNameSearchRB;
4983 private javax.swing.JTextField noteNameTF;
4984 private javax.swing.JComboBox<String> notesFoundComboBox;
4985 private javax.swing.JTextField opponentPokemonTF;
4986 private javax.swing.JLabel opponentWeaknessLabel;
4987 private javax.swing.JTextArea opponentWeaknessTable;
4988 private javax.swing.JButton pasteInputButton;
4989 private javax.swing.JRadioButton pokemonSearchRB;
4990 private javax.swing.JComboBox<String> pokemonStatCheckBox;
4991 private javax.swing.JLabel pokemonStatLabel;
4992 private javax.swing.JTextField pokemonTF;
4993 private java.awt.PopupMenu popupMenu1;
4994 private javax.swing.JComboBox<String> possibleMovesComboBox;
4995 private javax.swing.JTextField possibleMovesTF;
4996 private javax.swing.JLabel possibleThreatLabel;
4997 private javax.swing.JTextArea possibleThreatTA;
4998 private javax.swing.JTextArea predictTA;
4999 private javax.swing.JLabel predictedOpponentNextMoveLabel;
5000 private javax.swing.JButton processInputButton;
5001 private javax.swing.JButton refreshTableButton;
5002 private javax.swing.JButton saveButton;
5003 private javax.swing.JButton saveNoteButton;
5004 private javax.swing.JButton searchTeamButton;
5005 private javax.swing.JButton searchTextButton;
5006 private javax.swing.JLabel searchTextLabel1;
5007 private javax.swing.JTextField searchTextTF;
5008 private javax.swing.JButton startGameButton;
5009 private javax.swing.JScrollPane statSP;
5010 private javax.swing.JScrollPane statSP1;
5011 private javax.swing.JTable statTable;
5012 private javax.swing.JTable statTable1;
5013 private javax.swing.JTextField teamNameTF;
5014 private javax.swing.JTable teamTable;
5015 private javax.swing.JLabel threatsLabel;
5016 private javax.swing.JTextArea threatsTF;
5017 private javax.swing.JLabel yourAdvisedNextMoveLabel;
5018 private javax.swing.JTextArea yourAdvisedNextMoveTF;
5019 private javax.swing.JTextField yourPokemonTF;
5020 private javax.swing.JTextArea yourPredictionNextMoveTF;
5021 private javax.swing.JComboBox<String> yourTeamComboBox;
5022 private javax.swing.JLabel yourTeamLabel;
5023 private javax.swing.JLabel yourWeaknessLabel;
5024 private javax.swing.JTextArea yourWeaknessTable;
5025 // End of variables declaration
5026
5027 }
5028